Java TV(tm) API 1.0

javax.tv.media.protocol
Interface PushSourceStream2

All Superinterfaces:
javax.media.protocol.Controls, javax.media.protocol.PushSourceStream, javax.media.protocol.SourceStream

public interface PushSourceStream2
extends javax.media.protocol.PushSourceStream

The PushSourceStream2 interface identifies a SourceStream that pushes asynchronous data.

Note that a PushSourceStream2 provides no guarantees of the length of time that incoming data will be buffered before being discarded or overwritten with new data. Because of the time-dependent nature of the stream, clients should read the pending data immediately upon notification.

This interface is functionally identical to javax.media.protocol.PushSourceStream, except that it provides the readStream() method that throws exceptions. Instances of PushSourceStream2 may be obtained through the JMF method javax.media.protocol.PushDataSource.getStreams(). In Java TV implementations, objects returned by this method will be of type PushSourceStream2. Instances of PushDataSource are obtained by means of javax.media.Manager.createDataSource(javax.media.MediaLocator). If access to broadcast asynchronous data is not supported by the system, this method will throw javax.media.NoDataSourceException.

See Also:
javax.media.protocol.PushDataSource.getStreams()

Fields inherited from interface javax.media.protocol.SourceStream
LENGTH_UNKNOWN
 
Method Summary
 int readStream(byte[] buffer, int offset, int length)
          Reads pending data from the stream without blocking.
 
Methods inherited from interface javax.media.protocol.PushSourceStream
getMinimumTransferSize, read, setTransferHandler
 
Methods inherited from interface javax.media.protocol.SourceStream
endOfStream, getContentDescriptor, getContentLength
 
Methods inherited from interface javax.media.protocol.Controls
getControl, getControls
 

Method Detail

readStream

public int readStream(byte[] buffer,
                      int offset,
                      int length)
               throws java.io.IOException,
                      DataLostException
Reads pending data from the stream without blocking.
Parameters:
buffer - The buffer to read bytes into.
offset - The offset into the buffer at which to begin writing data.
length - The number of bytes to read.
Returns:
The number of bytes read or -1 when the end of stream is reached.
Throws:
java.io.IOException - If an I/O error occurs.
DataLostException - If data from the stream has been lost.
ArrayIndexOutOfBoundsException - If offset < 0, length < 0, or offset+length > buffer.length.

Java TV(tm) API 1.0

Copyright © 1998 - 2000 Sun Microsystems, Inc.