T - Type of the Reader passed in the constructor.public class CloseOnceReader<T extends Reader> extends FilterReader
A CloseOnceReader wraps some other Reader, which it
uses as its basic source of data. The class CloseOnceReader pass
all requests to the contained input stream, except the close()
method that is passed only one time to the underlying stream.
Multiple invocation of the close() method will result in only
one invocation of the same method on the underlying stream. This is useful
with some buggy Reader that don't allow close() to
be called multiple times.
in| Constructor and Description |
|---|
CloseOnceReader(T source)
Construct a
CloseOnceReader 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, skippublic CloseOnceReader(T source)
CloseOnceReader that forwards the calls to the
source Reader passed in the constructor.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 Closeableclose in interface AutoCloseableclose in class FilterReaderIOExceptionpublic int getCloseCount()
public T getWrappedReader()
Returns the wrapped (original) Reader passed in the
constructor.
Reader passed in the constructorCopyright © 2008–2016. All rights reserved.