public class DataSource extends PullDataSource
| Modifier and Type | Field and Description |
|---|---|
protected long |
length |
protected RandomAccessFile |
raf |
DURATION_UNBOUNDED, DURATION_UNKNOWN| Constructor and Description |
|---|
DataSource() |
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Open a connection to the source described by
the
MediaLocator. |
void |
disconnect()
Close the connection to the source described by the locator.
|
String |
getContentType()
Get a string that describes the content-type of the media
that the source is providing.
|
Object |
getControl(String controlType)
Obtain the object that implements the specified
Class or Interface
The full class or interface name must be used. |
Object[] |
getControls()
Obtain the collection of objects that
control the object that implements this interface.
|
protected String |
getCorrectedContentType(String contentType) |
Time |
getDuration()
Get the duration of the media represented
by this object.
|
PullSourceStream[] |
getStreams()
Get the collection of streams that this source
manages.
|
void |
setLocator(MediaLocator ml)
Set the connection
source for this DataSource. |
void |
start()
Initiate data-transfer.
|
void |
stop()
Stop the data-transfer.
|
getLocator, initCheckprotected RandomAccessFile raf
protected long length
public String getContentType()
DataSource
It is an error to call getContentType if the source is
not connected.
getContentType in class DataSourcepublic void connect()
throws IOException
DataSourceMediaLocator.
The connect method initiates communication with the source.
connect in class DataSourceIOException - Thrown if there are IO problems
when connect is called.public void disconnect()
DataSource
The disconnect method frees resources used to maintain a
connection to the source.
If no resources are in use, disconnect is ignored.
If stop hasn't already been called,
calling disconnect implies a stop.
disconnect in class DataSourcepublic void start()
throws IOException
DataSourcestart method must be
called before data is available.
(You must call connect before calling start.)start in class DataSourceIOException - Thrown if there are IO problems with the source
when start is called.public void stop()
throws IOException
DataSourcestop does nothing.stop in class DataSourceIOExceptionpublic void setLocator(MediaLocator ml)
DataSourcesource for this DataSource.
This method should only be called once; an error is thrown if
the locator has already been set.setLocator in class DataSourceml - The MediaLocator that describes the
media source.public PullSourceStream[] getStreams()
PullDataSourceDataSource provides the only indication of
what streams can be available on this connection.getStreams in class PullDataSourcepublic Time getDuration()
DurationgetDuration returns DURATION_UNKNOWN.Time object representing the duration or DURATION_UNKNOWN.public Object[] getControls()
ControlsIf no controls are supported, a zero length array is returned.
public Object getControl(String controlType)
ControlsClass or Interface
The full class or interface name must be used.
If the control is not supported then null
is returned.
null.Copyright © 2012 code4tv.com. All Rights Reserved.