javax.media.protocol
Interface PullBufferStream


public interface PullBufferStream
extends SourceStream

Abstracts a read interface that data is pulled from in the form of Buffer objects This interface allows a sourcestream to transfer data in the form of an entire media chunk to the user of this sourcestream. The media object or chunk transferred is the Buffer object as defined in javax.media.Buffer. The user of the stream will allocate an empty Buffer object and pass this over to the sourcestream in the read() method. The source of the stream will allocate the Buffer object's data and header, set them on the Buffer and send them over to the user. The structure of the data and header of the Buffer object is determined by the format attribute of the Buffer object or the content type of the sourcestream

It is possible for the user of the stream to indicate to the sourcestream to NOT allocate the data object, but to instead use the data passed in the read() method. In this case, the user must pass non null data object to the stream in the Buffer object. The type of data can be determined by the getDataType() method on the format object returned by calling getFormat on this bufferstream. The getDataType method will return a Class describing the Buffer's data and can be used by the stream user to allocate its own data and hand it over to the read method.

Since:
JMF 2.0
See Also:
Format, Buffer, PullBufferDataSource

Fields inherited from interface javax.media.protocol.SourceStream
LENGTH_UNKNOWN
 
Method Summary
 Format getFormat()
          Get the format type of the data that this source stream provides.
 void read(Buffer buffer)
          Block and read a buffer from the stream.
 boolean willReadBlock()
          Find out if data is available now.
 
Methods inherited from interface javax.media.protocol.SourceStream
endOfStream, getContentDescriptor, getContentLength
 
Methods inherited from interface javax.media.Controls
getControl, getControls
 

Method Detail

willReadBlock

public boolean willReadBlock()
Find out if data is available now. Returns true if a call to read would block for data.
Returns:
true if read would block; otherwise returns false.

read

public void read(Buffer buffer)
          throws java.io.IOException
Block and read a buffer from the stream. buffer should be non-null.

Throws:
java.io.IOException - Thrown if an error occurs while reading.

getFormat

public Format getFormat()
Get the format type of the data that this source stream provides.
Returns:
A Format object that describes the data in this stream.


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.