FileDocCategorySizeDatePackage
DataSink.javaAPI DocJMF 2.1.1e3950Mon May 12 12:20:38 BST 2003javax.media

DataSink

public interface DataSink implements MediaHandler, Controls
DataSink is the base interface for objects that read media content delivered by a DataSource and render the media to some destination. The destination is specified with a MediaLocator. One example of a DataSink is a file writer object that stores the media in a file.

A DataSink is created according to the factory mechanism used to create a Player.

see
Manager#createDataSink
since
JMF 2.0

Fields Summary
Constructors Summary
Methods Summary
public voidaddDataSinkListener(javax.media.datasink.DataSinkListener listener)
Adds an event listener for events generated by this DataSink.

param
listener The DataSinkListener to add.

public voidclose()
Closes the connection to the destination described by the output MediaLocator. This method frees the resources used to maintain a connection to the destination. If no resources are in use, close is ignored. If stop hasn't already been called, calling close stops the data transfer. A DataSink can no longer be used once it has been closed.

public java.lang.StringgetContentType()
Gets a string that describes the content type of the media that this DataSink is consuming.

return
A String that contains the name of the content-type.

public javax.media.MediaLocatorgetOutputLocator()
Gets the output MediaLocator that describes where the output of this DataSink goes.

return
The output MediaLocator for this DataSink.

public voidopen()
Opens a connection to the destination described by the output MediaLocator. This method establishes a channel between this DataSink and its destination.

exception
IOException If there are IO problems when open is called.
exception
SecurityException If there are any security violations while attempting to access the destination described by the output MediaLocator.

public voidremoveDataSinkListener(javax.media.datasink.DataSinkListener listener)
Removes the specified event listener from this DataSink.

param
listener The DataSinkListener to remove.

public voidsetOutputLocator(javax.media.MediaLocator output)
Sets the output MediaLocator for this DataSink. This method should only be called once; an error is thrown if the locator has already been set.

param
output A MediaLocator that describes where the output of this DataSink goes.

public voidstart()
Initiates data transfer. You must call open before calling the start method.

exception
IOException If there are IO problems with the source when start is called.

public voidstop()
Stops the data transfer. If the source has not been connected and started, stop does nothing.

exception
IOException If there are IO problems with the source when stop is called.