javax.media
Interface DataSink


public abstract interface DataSink
extends MediaHandler, Controls

DataSink is the base interface for objects that read media content delivered from a DataSource, and render the media to some destination. The destination is specified with a MediaLocator. An example is a file writer object that records the media to a file.

Creation of DataSink is done according to the factory mechanism for players. See Manager.createDataSink() for more information.

Since:
JMF 2.0

Method Summary
 void close()
          Close the connection to the source described by the locator.
 java.lang.String getContentType()
          Get a string that describes the content-type of the media that the datasink is consuming.
 MediaLocator getOutputLocator()
          Get the output MediaLocator that describes where the output of this DataSink goes.
 void open()
          Open a connection to the destination described by the output MediaLocator.
 void setOutputLocator(MediaLocator output)
          Set the output MediaLocator.
 void start()
          Initiate data-transfer.
 void stop()
          Stop the data-transfer.
 
Methods inherited from interface javax.media.MediaHandler
setSource
 
Methods inherited from interface javax.media.Controls
getControl, getControls
 

Method Detail

setOutputLocator

public void setOutputLocator(MediaLocator output)
Set the output MediaLocator. This method should only be called once; an error is thrown if the locator has already been set.
Parameters:
output - MediaLocator that describes where the output goes.

getOutputLocator

public MediaLocator getOutputLocator()
Get the output MediaLocator that describes where the output of this DataSink goes.
Returns:
the output MediaLocator for this DataSink.

start

public void start()
           throws java.io.IOException
Initiate data-transfer. You must call open before calling start
Throws:
java.io.IOException - Thrown if there are IO problems with the source when start is called.

stop

public void stop()
          throws java.io.IOException
Stop the data-transfer. If the source has not been connected and started, stop does nothing.

open

public void open()
          throws java.io.IOException,
                 java.lang.SecurityException
Open a connection to the destination described by the output MediaLocator.

The open method establishes a channel with the destination as described in the medialocator.

Throws:
java.io.IOException - Thrown if there are IO problems when open is called.
java.lang.SecurityException - thrown if there is any security violation while attempting to access the destination as described by the medialocator

close

public void close()
Close the connection to the source described by the locator.

The close method frees resources used to maintain a connection to the destination described in the medialocator. If no resources are in use, close is ignored. If stop hasn't already been called, calling close implies a stop. The DataSink may no longer be used after being closed.


getContentType

public java.lang.String getContentType()
Get a string that describes the content-type of the media that the datasink is consuming.
Returns:
The name that describes the media content.