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 InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public long skip(long n) throws IOException
skip
in class InputStream
IOException
public int available() throws IOException
available
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
public void mark(int readlimit)
mark
in class InputStream
public void reset() throws IOException
reset
in class InputStream
IOException
public boolean markSupported()
markSupported
in class InputStream
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.