public class FilterInputStream2
extends java.io.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 java.io.InputStream |
delegate
The underlying
InputStream instance. |
Constructor and Description |
---|
FilterInputStream2(java.io.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 java.io.InputStream delegate
InputStream
instance.public FilterInputStream2(java.io.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 java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public long skip(long n) throws java.io.IOException
skip
in class java.io.InputStream
java.io.IOException
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
public void mark(int readlimit)
mark
in class java.io.InputStream
public void reset() throws java.io.IOException
reset
in class java.io.InputStream
java.io.IOException
public boolean markSupported()
markSupported
in class java.io.InputStream
Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.