RoboJDETM v2.0

java.io
Class InputStream

java.lang.Object
  extended by java.io.InputStream

public abstract class InputStream
extends Object

Abstract base class for input streams.


Constructor Summary
InputStream()
          Constructor for subclasses to call.
 
Method Summary
 int available()
          Returns the number of bytes available for input.
 void close()
          Closes the input stream.
abstract  int read()
          Reads a byte from the input stream.
 int read(byte[] buffer)
          Reads the input stream until the provided buffer has been filled, the end of stream has been reached or an exception has been thrown.
 int read(byte[] buffer, int offset, int length)
          Reads the input stream until the specified number of bytes have been read, the end of stream has been reached or an exception has been thrown.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Constructor Detail

InputStream

public InputStream()
Constructor for subclasses to call.

Method Detail

available

public int available()
              throws IOException
Returns the number of bytes available for input.

Typically subclassses override this method to return the correct value. The implementation in the base class (InputStream) always returns 0.

Returns:
Number of bytes available to read.
Throws:
IOException

close

public void close()
           throws IOException
Closes the input stream.

Throws:
IOException

read

public abstract int read()
                  throws IOException
Reads a byte from the input stream.

This method blocks if no data is available.

Returns:
byte read from the stream or -1 if the end of stream is reached
Throws:
IOException

read

public int read(byte[] buffer)
         throws IOException
Reads the input stream until the provided buffer has been filled, the end of stream has been reached or an exception has been thrown.

This method blocks if no data is available.

Parameters:
buffer - buffer to fill
Returns:
count of bytes read or -1 if the end of stream was reached
Throws:
IOException

read

public int read(byte[] buffer,
                int offset,
                int length)
         throws IOException
Reads the input stream until the specified number of bytes have been read, the end of stream has been reached or an exception has been thrown.

This implementation repeatedly calls the subclasses read method to retrieve bytes.

This method blocks if no data is available.

Parameters:
buffer - buffer to fill
offset - offset to position in buffer to start filling data
length - number of bytes to read
Returns:
count of bytes read or -1 if the end of stream was reached
Throws:
IOException

RoboJDETM v2.0

Copyright (c) 2003-2009 RidgeSoft, LLC. All rights reserved.
www.ridgesoft.com