Name
InputStream
Synopsis
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; ...
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.