|
||||||||||
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 org.yajul.io.AbstractByteFilterInputStream
public abstract class AbstractByteFilterInputStream
Implements the array based read method to simplify writing 'byte at a time'
FilterInputStream classes. Sub-classes need only implement the read()
method.
User: josh
Date: Nov 27, 2002
Time: 8:38:44 AM
Field Summary |
---|
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
AbstractByteFilterInputStream(java.io.InputStream in)
Creates a new AbstractByteFilterInputStream. |
|
AbstractByteFilterInputStream(java.io.InputStream in,
int pushbackBufferSize)
Creates a new AbstractByteFilterInputStream with a built in 'pushback buffer' which enables the 'unread' methods. |
Method Summary | |
---|---|
protected int |
insert(byte[] bytes)
Pushes all of the bytes after the first one into the pushback buffer and returns the first byte, effectively inserting the bytes into the stream. |
abstract int |
read()
Reads the next byte of data from this input stream. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from this input stream
into an array of bytes. |
protected int |
readByte()
Reads the next byte of data from this input stream. |
Methods inherited from class java.io.FilterInputStream |
---|
available, close, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractByteFilterInputStream(java.io.InputStream in, int pushbackBufferSize)
in
- The underlying input stream being filtered.pushbackBufferSize
- The size of the pushback buffer.public AbstractByteFilterInputStream(java.io.InputStream in)
in
- The underlying input stream being filtered.Method Detail |
---|
protected final int readByte() throws java.io.IOException
int
in the range
0
to 255
. If no byte is available
because the end of the stream has been reached, the value
-1
is returned. This method blocks until input data
is available, the end of the stream is detected, or an exception
is thrown.
-1
if the end of the
stream is reached.
java.io.IOException
- if an I/O error occurs.FilterInputStream.in
public abstract int read() throws java.io.IOException
int
in the range
0
to 255
. If no byte is available
because the end of the stream has been reached, the value
-1
is returned. This method blocks until input data
is available, the end of the stream is detected, or an exception
is thrown.
read
in class java.io.FilterInputStream
-1
if the end of the
stream is reached.
java.io.IOException
- if an I/O error occurs.FilterInputStream.in
public final int read(byte[] b, int off, int len) throws java.io.IOException
len
bytes of data from this input stream
into an array of bytes. This method blocks until some input is
available.
This method simply performs in.read(b, off, len)
and returns the result.
read
in class java.io.FilterInputStream
b
- the buffer into which the data is read.off
- the start offset of the data.len
- the maximum number of bytes read.
-1
if there is no more data because the end of
the stream has been reached.
java.io.IOException
- if an I/O error occurs.FilterInputStream.in
protected int insert(byte[] bytes) throws java.io.IOException
bytes
- The bytes to insert into the stream.
java.io.IOException
- if something goes wrong.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |