Team LiB
Previous Section Next Section

InputStreamjava.io

Java 1.0closeable

This abstract class is the superclass of all input streams. It defines the basic input methods all input stream classes provide. read( ) reads a single byte or an array (or subarray) of bytes. It returns the bytes read, the number of bytes read, or -1 if the end-of-file has been reached. skip( ) skips a specified number of bytes of input. available( ) returns the number of bytes that can be read without blocking. close( ) closes the input stream and frees up any system resources associated with it. The stream should not be used after close( ) has been called.

If markSupported( ) returns TRue for a given InputStream, that stream supports mark( ) and reset( ) methods. mark( ) marks the current position in the input stream so that reset( ) can return to that position (as long as no more than the specified number of bytes have been read between the calls to mark( ) and reset( )). See also Reader.

Figure 9-25. java.io.InputStream


public abstract class InputStream implements Closeable {
// Public Constructors
     public InputStream( );  
// Public Instance Methods
     public int available( ) throws IOException;                       constant
     public void close( ) throws IOException;    Implements:Closeable empty
     public void mark(int readlimit);                    synchronized empty
     public boolean markSupported( );                                  constant
     public abstract int read( ) throws IOException;  
     public int read(byte[ ] b) throws IOException;  
     public int read(byte[ ] b, int off, int len) throws IOException;  
     public void reset( ) throws IOException;                    synchronized
     public long skip(long n) throws IOException;  
// Methods Implementing Closeable
     public void close( ) throws IOException;                          empty
}

Subclasses

ByteArrayInputStream, FileInputStream, FilterInputStream, ObjectInputStream, PipedInputStream, SequenceInputStream, StringBufferInputStream

Passed To

Too many methods to list.

Returned By

Too many methods to list.

Type Of

FilterInputStream.in, System.in

    Team LiB
    Previous Section Next Section