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 PullSourceStream

All Superinterfaces:
Controls, SourceStream

public interface PullSourceStream
extends SourceStream

Abstracts a read interface that data is pulled from.

See Also:
PullDataSource

Field Summary
 
Fields inherited from interface javax.media.protocol.SourceStream
LENGTH_UNKNOWN
 
Method Summary
 int read(byte[] buffer, int offset, int length)
          Block and read data 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.protocol.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:
Returns true if read would block; otherwise returns false.

read

public int read(byte[] buffer,
                int offset,
                int length)
         throws java.io.IOException
Block and read data from the stream.

Reads up to length bytes from the input stream into an array of bytes. If the first argument is null, up to length bytes are read and discarded. Returns -1 when the end of the media is reached. This method only returns 0 if it was called with a length of 0.

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, -1 indicating the end of stream, or 0 indicating read was called with length 0.
Throws:
java.io.IOException - Thrown if an error occurs while reading.

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.