Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

Copyright © 2006 Sun Microsystems, Inc. All rights reserved.

JSR-927 (Maintenance Release)

javax.media.protocol
Interface PushSourceStream

All Superinterfaces:
Controls, SourceStream

public interface PushSourceStream
extends SourceStream

Abstracts a read interface that pushes data.

See Also:
PushDataSource

Field Summary
 
Fields inherited from interface javax.media.protocol.SourceStream
LENGTH_UNKNOWN
 
Method Summary
 int getMinimumTransferSize()
          Determine the size of the buffer needed for the data transfer.
 int read(byte[] buffer, int offset, int length)
          Read from the stream without blocking.
 void setTransferHandler(SourceTransferHandler transferHandler)
          Register an object to service data transfers to this stream.
 
Methods inherited from interface javax.media.protocol.SourceStream
endOfStream, getContentDescriptor, getContentLength
 
Methods inherited from interface javax.media.protocol.Controls
getControl, getControls
 

Method Detail

read

public int read(byte[] buffer,
                int offset,
                int length)
Read from the stream without blocking. Returns -1 when the end of the media is reached.

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.

getMinimumTransferSize

public int getMinimumTransferSize()
Determine the size of the buffer needed for the data transfer. This method is provided so that a transfer handler can determine how much data, at a minimum, will be available to transfer from the source. Overflow and data loss is likely to occur if this much data isn't read at transfer time.

Returns:
The size of the data transfer.

setTransferHandler

public void setTransferHandler(SourceTransferHandler transferHandler)
Register an object to service data transfers to this stream.

If a handler is already registered when setTransferHandler is called, the handler is replaced; there can only be one handler at a time.

Parameters:
transferHandler - The handler to transfer data to.

JSR-927 (Maintenance Release)

Copyright © 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

For more information, please consult the JSR 927 specification.