All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----javax.media.protocol.DataSource
DataSource is an abstraction for media protocol-handlers.
DataSource manages the life-cycle of the media source
by providing a simple connection protocol.
DataSource might support an operation
that is not part of the DataSource
class definition. For example a source could support
positioning its media to a particular time.
Some operations are dependent on the data stream that the
source is managing, and support cannot be determined
until after the source has been connected.
To obtain all of the objects that provide control
over a DataSource, use getControls
which returns an array of Object
To determine if a particular kind of control
is available and obtain the object that implements
it, use getControl which takes
the name of the Class or Interface that of the
desired control.
Class.newInstance.
DataSource from a MediaLocator.
MediaLocator.
Class or Interface
The full class or interface name must be used.
MediaLocator that describes this source.
MediaLocator.
source for this DataSource.
public DataSource()
Class.newInstance.
public DataSource(MediaLocator source)
DataSource from a MediaLocator.
This method should be overloaded by subclasses;
the default implementation just keeps track of
the MediaLocator.
MediaLocator that describes
the DataSource.
public void setLocator(MediaLocator source)
source for this DataSource.
This method should only be called once; an error is thrown if
the locator has already been set.
MediaLocator that describes the
media source.
public MediaLocator getLocator()
MediaLocator that describes this source.
Returns null if the locator hasn't been set.
(Very unlikely.)
MediaLocator for this source.
protected void initCheck()
MediaLocator.
If the connection hasn't been initialized,
initCheck throws an UninitializedError.
Most methods should call initCheck on entry.
public abstract String getContentType()
It is an error to call getContentType if the source is
not connected.
public abstract void connect() throws IOException
MediaLocator.
The connect method initiates communication with the source.
connect is called.
public abstract void disconnect()
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.
public abstract void start() throws IOException
start method must be
called before data is available.
(You must call connect before calling start.)
start is called.
public abstract void stop() throws IOException
stop does nothing.
All Packages Class Hierarchy This Package Previous Next Index