Java Reference
In-Depth Information
Table 18-2
java.io.InputStream
RETURNS
NAME
DESCRIPTION
int
available()
Returns the number of bytes that
can be read (or skipped over) from
the current input stream without
blocking.
void
close()
Closes this input stream.
void
mark(int readlimit)
Marks the current position in the
input stream.
boolean
markSupported()
Tests if this input stream supports
the mark and reset methods.
int
read()
Reads the next byte of data from the
input stream.
int
read(byte[] b)
Reads a number of bytes from the
input stream and stores them into
the buffer array b.
int
read(byte[] b,
int o, int l)
Reads up to l bytes of data from
the input stream into an array b at
offset o.
void
reset()
Repositions this stream to the
position at the time the mark
Method was last called.
long
skip(long n)
Skips over and discards n bytes of
data from this input stream.
Thefirstimplementationofread()hasthefollowingsignature:
public abstract int read()
throws IOException
This version reads the next byte of data from the input stream. The
method waits until a byte of data is available or until the end of the
stream is reached or an exception is raised. The value is returned as an
int in the range 0 to 255. The value -1 is returned when the end of the
stream is reached. Notice that this is an abstract method that cannot be
instantiated.
Thesecondimplementationofread()hasthefollowingsignature:
public int read(byte[] b)
throws IOException
This version reads a number of bytes from the input stream and stores
them in an array of type byte. The value returned is the number of bytes
 
Search WWH ::




Custom Search