T
- Type of the Reader passed in the constructor.public class CloseShieldReader<T extends Reader> extends FilterReader
A CloseShieldReader
wraps some other Reader
,
which it uses as its basic source of data. The class
CloseShieldReader
pass all requests to the contained stream,
except the close() method that is not to the underlying
stream.
This class is typically used in cases where a Reader
needs to
be passed to a component that wants to explicitly close the stream even if
more input would still be available to other components.
in
Constructor and Description |
---|
CloseShieldReader(T source)
Construct a
CloseShieldReader that forwards the calls to
the source Reader passed in the constructor. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
int |
getCloseCount()
Returns the number of time that close was called.
|
T |
getWrappedReader()
Returns the wrapped (original)
Reader passed in the
constructor. |
mark, markSupported, read, read, ready, reset, skip
public CloseShieldReader(T source)
CloseShieldReader
that forwards the calls to
the source Reader passed in the constructor.T
- a T object.source
- original Readerpublic void close() throws IOException
Multiple invocation of this method will result in only one invocation
of the close()
on the underlying stream.
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterReader
IOException
public int getCloseCount()
public T getWrappedReader()
Returns the wrapped (original) Reader
passed in the
constructor.
Reader
passed in the constructorCopyright © 2008–2016. All rights reserved.