|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.InputStream | +--java.io.FilterInputStream | +--java.io.BufferedInputStream
A buffered input stream. This stream lets you read in characters from a stream without causing a read every time. The data is read into a buffer, subsequent reads result in a fast buffer access.
Field Summary | |
protected byte[] |
buf
The buffer where data is stored. |
protected int |
count
The number of bytes in the buffer. |
protected int |
marklimit
The maximum readahead allowed after a mark() before subsequent calls to reset() fail. |
protected int |
markpos
The position in the buffer of the current mark. |
protected int |
pos
The current position in the buffer. |
Fields inherited from class java.io.FilterInputStream |
in |
Constructor Summary | |
BufferedInputStream(InputStream in)
Creates a new buffered stream with a default buffer size. |
|
BufferedInputStream(InputStream in,
int size)
Creates a new buffered stream with the specified buffer size. |
Method Summary | |
int |
available()
Returns the number of bytes that can be read without blocking. |
void |
mark(int readlimit)
Marks the current position in the input stream. |
boolean |
markSupported()
Returns a boolean indicating if this stream type supports mark/reset. |
int |
read()
Reads a byte of data. |
int |
read(byte[] b,
int off,
int len)
Reads into an array of bytes. |
void |
reset()
Repositions the stream to the last marked position. |
long |
skip(long n)
Skips n bytes of input. |
Methods inherited from class java.io.FilterInputStream |
close, read |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected byte[] buf
protected int count
protected int pos
protected int markpos
protected int marklimit
Constructor Detail |
public BufferedInputStream(InputStream in)
in
- the input streampublic BufferedInputStream(InputStream in, int size)
in
- the input streamsize
- the buffer sizeMethod Detail |
public int read() throws IOException
read
in class FilterInputStream
IOException
- If an I/O error has occurred.public int read(byte[] b, int off, int len) throws IOException
read
in class FilterInputStream
b
- the buffer into which the data is readoff
- the start offset of the datalen
- the maximum number of bytes read
IOException
- If an I/O error has occurred.public long skip(long n) throws IOException
skip
in class FilterInputStream
n
- the number of bytes to be skipped
IOException
- If an I/O error has occurred.public int available() throws IOException
available
in class FilterInputStream
IOException
public void mark(int readlimit)
mark
in class FilterInputStream
readlimit
- the maximum limit of bytes allowed to be read before the
mark position becomes invalid.public void reset() throws IOException
reset
in class FilterInputStream
IOException
- If the stream has not been marked or if the mark has been
invalidated.public boolean markSupported()
markSupported
in class FilterInputStream
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |