javax.media
Interface DataSink


public interface DataSink
extends 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.

Since:
JMF 2.0
See Also:
Manager.createDataSink(javax.media.protocol.DataSource, javax.media.MediaLocator)

Method Summary
 void addDataSinkListener(DataSinkListener listener)
          Adds an event listener for events generated by this DataSink.
 void close()
          Closes the connection to the destination described by the output MediaLocator.
 java.lang.String getContentType()
          Gets a string that describes the content type of the media that this DataSink is consuming.
 MediaLocator getOutputLocator()
          Gets the output MediaLocator that describes where the output of this DataSink goes.
 void open()
          Opens a connection to the destination described by the output MediaLocator.
 void removeDataSinkListener(DataSinkListener listener)
          Removes the specified event listener from this DataSink.
 void setOutputLocator(MediaLocator output)
          Sets the output MediaLocator for this DataSink.
 void start()
          Initiates data transfer.
 void stop()
          Stops 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)
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.
Parameters:
output - A MediaLocator that describes where the output of this DataSink goes.

getOutputLocator

public MediaLocator getOutputLocator()
Gets 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
Initiates data transfer. You must call open before calling the start method.
Throws:
java.io.IOException - If there are IO problems with the source when start is called.

stop

public void stop()
          throws java.io.IOException
Stops the data transfer. If the source has not been connected and started, stop does nothing.
Throws:
java.io.IOException - If there are IO problems with the source when stop is called.

open

public void open()
          throws java.io.IOException,
                 java.lang.SecurityException
Opens a connection to the destination described by the output MediaLocator. This method establishes a channel between this DataSink and its destination.
Throws:
java.io.IOException - If there are IO problems when open is called.
java.lang.SecurityException - If there are any security violations while attempting to access the destination described by the output MediaLocator.

close

public void close()
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.

getContentType

public java.lang.String getContentType()
Gets a string that describes the content type of the media that this DataSink is consuming.
Returns:
A String that contains the name of the content-type.

addDataSinkListener

public void addDataSinkListener(DataSinkListener listener)
Adds an event listener for events generated by this DataSink.
Parameters:
listener - The DataSinkListener to add.

removeDataSinkListener

public void removeDataSinkListener(DataSinkListener listener)
Removes the specified event listener from this DataSink.
Parameters:
listener - The DataSinkListener to remove.


Submit a bug or feature
Copyright 1999-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved. See the Specification License for more details.
Sun, Sun Microsystems, and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.