All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class javax.media.protocol.DataSource

java.lang.Object
   |
   +----javax.media.protocol.DataSource

public abstract class DataSource
extends Object
implements Controls, Duration
A DataSource is an abstraction for media protocol-handlers. DataSource manages the life-cycle of the media source by providing a simple connection protocol.

Source Controls

A 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.

Version:
1.16, 97/08/26
See Also:
Manager, DefaultPlayerFactory, Positionable, RateConfigureable

Constructor Index

 o DataSource()
A no-argument constructor required by pre 1.1 implementations so that this class can be instantiated by calling Class.newInstance.
 o DataSource(MediaLocator)
Construct a DataSource from a MediaLocator.

Method Index

 o connect()
Open a connection to the source described by the MediaLocator.
 o disconnect()
Close the connection to the source described by the locator.
 o getContentType()
Get a string that describes the content-type of the media that the source is providing.
 o getControl(String)
Obtain the object that implements the specified Class or Interface The full class or interface name must be used.
 o getControls()
Obtain the collection of objects that control the object that implements this interface.
 o getDuration()
Get the duration of the media represented by this object.
 o getLocator()
Get the MediaLocator that describes this source.
 o initCheck()
Check to see if this connection has been initialized with a MediaLocator.
 o setLocator(MediaLocator)
Set the connection source for this DataSource.
 o start()
Initiate data-transfer.
 o stop()
Stop the data-transfer.

Constructors

 o DataSource
 public DataSource()
A no-argument constructor required by pre 1.1 implementations so that this class can be instantiated by calling Class.newInstance.

 o DataSource
 public DataSource(MediaLocator source)
Construct a DataSource from a MediaLocator. This method should be overloaded by subclasses; the default implementation just keeps track of the MediaLocator.

Parameters:
source - The MediaLocator that describes the DataSource.

Methods

 o setLocator
 public void setLocator(MediaLocator source)
Set the connection source for this DataSource. This method should only be called once; an error is thrown if the locator has already been set.

Parameters:
source - The MediaLocator that describes the media source.
 o getLocator
 public MediaLocator getLocator()
Get the MediaLocator that describes this source. Returns null if the locator hasn't been set. (Very unlikely.)

Returns:
The MediaLocator for this source.
 o initCheck
 protected void initCheck()
Check to see if this connection has been initialized with a MediaLocator. If the connection hasn't been initialized, initCheck throws an UninitializedError. Most methods should call initCheck on entry.

 o getContentType
 public abstract String getContentType()
Get a string that describes the content-type of the media that the source is providing.

It is an error to call getContentType if the source is not connected.

Returns:
The name that describes the media content.
 o connect
 public abstract void connect() throws IOException
Open a connection to the source described by the MediaLocator.

The connect method initiates communication with the source.

Throws: IOException
Thrown if there are IO problems when connect is called.
 o disconnect
 public abstract void disconnect()
Close the connection to the source described by the locator.

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.

 o start
 public abstract void start() throws IOException
Initiate data-transfer. The start method must be called before data is available. (You must call connect before calling start.)

Throws: IOException
Thrown if there are IO problems with the source when start is called.
 o stop
 public abstract void stop() throws IOException
Stop the data-transfer. If the source has not been connected and started, stop does nothing.


All Packages  Class Hierarchy  This Package  Previous  Next  Index