javax.media.protocol
Class InputSourceStream

java.lang.Object
  |
  +--javax.media.protocol.InputSourceStream

public class InputSourceStream
extends java.lang.Object
implements PullSourceStream

Build a source stream out of an input stream.

See Also:
DataSource, SourceStream, InputStream

Field Summary
protected  boolean eosReached
           
protected  java.io.InputStream stream
           
 
Fields inherited from interface javax.media.protocol.SourceStream
LENGTH_UNKNOWN
 
Constructor Summary
InputSourceStream(java.io.InputStream s, ContentDescriptor type)
          Construct an InputSourceStream from an input stream.
 
Method Summary
 void close()
          Turn the stream off.
 boolean endOfStream()
          Return if the end of stream has been reached.
 ContentDescriptor getContentDescriptor()
          Get the content type for this stream.
 long getContentLength()
          Obtain the content length
 java.lang.Object getControl(java.lang.String controlName)
          Returns null because no controls are implemented.
 java.lang.Object[] getControls()
          Returns an zero length array because no controls are supported.
 int read(byte[] buffer, int offset, int length)
          Read a buffer of data.
 boolean willReadBlock()
          Query if the next read will block.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stream

protected java.io.InputStream stream

eosReached

protected boolean eosReached
Constructor Detail

InputSourceStream

public InputSourceStream(java.io.InputStream s,
                         ContentDescriptor type)
Construct an InputSourceStream from an input stream.
Parameters:
s - The input stream to build the source stream from.
type - The content-type of the source stream.
Method Detail

getContentDescriptor

public ContentDescriptor getContentDescriptor()
Get the content type for this stream.
Returns:
content descriptor for the stream.

getContentLength

public long getContentLength()
Obtain the content length
Returns:
content length for this stream.

willReadBlock

public boolean willReadBlock()
Query if the next read will block.
Specified by:
willReadBlock in interface PullSourceStream
Returns:
true if a read will block.

read

public int read(byte[] buffer,
                int offset,
                int length)
         throws java.io.IOException
Read a buffer of data.
Specified by:
read in interface PullSourceStream
Parameters:
buffer - The buffer to read data into.
offset - The offset into the buffer for reading.
length - The number of bytes to read.
Returns:
The number of bytes read or -1 indicating end-of-stream.

close

public void close()
           throws java.io.IOException
Turn the stream off.
Throws:
java.io.IOException - Thrown if there is a problem closing the stream.

endOfStream

public boolean endOfStream()
Return if the end of stream has been reached.
Returns:
true if the end of the stream has been reached.

getControls

public java.lang.Object[] getControls()
Returns an zero length array because no controls are supported.
Returns:
a zero length Object array.

getControl

public java.lang.Object getControl(java.lang.String controlName)
Returns null because no controls are implemented.
Returns:
null.


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.