FileDocCategorySizeDatePackage
CachedStream.javaAPI DocJMF 2.1.1e2174Mon May 12 12:20:40 BST 2003javax.media.protocol

CachedStream

public interface CachedStream
This interface is implemented by a SourceStream that caches downloaded data for fast delivery to the handler. It provides control over enabling/disabling the buffering and provides a way to query if a certain number of bytes are available to be read from the stream.

Buffering here refers to jitter-buffering. Buffering is normally enabled. It enables smooth playback even if the incoming data rate fluctuates. The amount of buffering is implementation dependant.

When parsing the header of a media file, the parser may want to read a few bytes to check for say a valid magic header; if the magic header is illegal, the parser can throw a BadHeaderException. The parser may build several tables and extract media track information.

The parser typically doen't need to wait for the buffers to be filled. So it is desirable to turn off buffering when parsing the header and turn it on after the header is read. This won't have any effect on playback smoothness since playback cannot start until the header is parsed.

see
PullSourceStream
see
PushSourceStream
since
JMF 2.0

Fields Summary
Constructors Summary
Methods Summary
public voidabortRead()
Aborts a read if it is in progress.

public booleangetEnabledBuffering()
Tells if buffering is currently enabled or not.

public voidsetEnabledBuffering(boolean b)
This method is used by the parser to turn off buffering while the header is being read. Buffering is on by default.

public booleanwillReadBytesBlock(long offset, int numBytes)
Will seek to offset and read numBytes block? Will return true unless numBytes bytes can be read in one read call.

public booleanwillReadBytesBlock(int numBytes)
Will read numBytes block? Will return true unless numBytes bytes can be read in one read call.