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.InputStreamjava.io.IOExceptionpublic int read(byte[] b)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic long skip(long n)
throws java.io.IOException
skip in class java.io.InputStreamjava.io.IOExceptionpublic int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOExceptionpublic void mark(int readlimit)
mark in class java.io.InputStreampublic void reset()
throws java.io.IOException
reset in class java.io.InputStreamjava.io.IOExceptionpublic boolean markSupported()
markSupported in class java.io.InputStreamCopyright © 2000–2025 The Apache Software Foundation. All rights reserved.