public class FilterInputStream2 extends InputStream
FilterInputStream2 contains another
InputStream, which it uses as its basic
source of data, possibly transforming the data along the
way or providing additional functionality.
Note: unlike FilterInputStream this class
delegates every method by default. This means to transform
read calls, you need to override multiple methods.
On the other hand, it is less trappy: a simple implementation
that just overrides close will not force bytes to be
read one-at-a-time.
| Modifier and Type | Field and Description |
|---|---|
protected InputStream |
delegate
The underlying
InputStream instance. |
| Constructor and Description |
|---|
FilterInputStream2(InputStream delegate)
Construct a
FilterInputStream2 based on
the specified base stream. |
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
long |
skip(long n) |
protected final InputStream delegate
InputStream instance.public FilterInputStream2(InputStream delegate)
FilterInputStream2 based on
the specified base stream.
Note that base stream is closed if this stream is closed.
delegate - specified base stream.public int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b)
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamIOExceptionpublic long skip(long n)
throws IOException
skip in class InputStreamIOExceptionpublic int available()
throws IOException
available in class InputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic void mark(int readlimit)
mark in class InputStreampublic void reset()
throws IOException
reset in class InputStreamIOExceptionpublic boolean markSupported()
markSupported in class InputStreamCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.