public class BufferedInputStream extends FilterInputStream
Modifier and Type | Field and Description |
---|---|
protected byte[] |
buf |
protected int |
count |
protected int |
marklimit |
protected int |
markpos |
protected int |
pos |
in
Constructor and Description |
---|
BufferedInputStream(InputStream in)
Creates a BufferedInputStream and saves its argument, the input stream in, for later use.
|
BufferedInputStream(InputStream in,
int size)
Creates a BufferedInputStream with the specified buffer size, and saves
its argument, the input stream in, for later use.
|
Modifier and Type | Method and Description |
---|---|
int |
available()
Returns an estimate of the number of bytes that can be read (or skipped over) from this input
stream without blocking by the next invocation of a method for this input stream.
|
void |
mark(int rlimit)
Mark the current position in the stream.
|
boolean |
markSupported()
Tests if this input stream supports the mark and reset methods.
|
int |
read()
Reads the next byte of data.
|
int |
read(byte[] arr,
int ofs,
int len)
Reads bytes from this byte-input stream into the specified byte array, starting at the given offset.
|
void |
reset()
The stream is positioned to the last mark.
|
long |
skip(long cnt)
Skip a number of bytes from the input stream.
|
close, read
protected byte[] buf
protected int count
protected int pos
protected int markpos
protected int marklimit
public BufferedInputStream(InputStream in)
in
- the underlying input stream.public BufferedInputStream(InputStream in, int size)
in
- the underlying input stream.size
- the buffer size.public int available() throws IOException
available
in class FilterInputStream
IOException
- if this input stream has been closed by invoking its close() method, or an I/O error occurs.public void mark(int rlimit)
mark
in class FilterInputStream
rlimit
- the maximum limit of bytes that can be read before the mark position becomes invalid.public boolean markSupported()
markSupported
in class FilterInputStream
public int read() throws IOException
read
in class FilterInputStream
IOException
- if this input stream has been closed by invoking its close() method, or an I/O error occurs.public int read(byte[] arr, int ofs, int len) throws IOException
read
in class FilterInputStream
arr
- destination arrayofs
- offset at which to start storing byteslen
- maximum number of bytes to readIOException
- if this input stream has been closed by invoking its close() method, or an I/O error occurs.public void reset() throws IOException
reset
in class FilterInputStream
IOException
- if this stream has not been marked or, if the mark has been invalidated,
or the stream has been closed by invoking its close() method, or an I/O error occurs.public long skip(long cnt) throws IOException
skip
in class FilterInputStream
cnt
- the number of bytes to be skipped.IOException
- if the stream does not support seek, or if this input stream has been
closed by invoking its close() method, or an I/O error occurs.