T - Type of the InputStream passed in the constructor.public class CloseOnceInputStream<T extends InputStream> extends FilterInputStream
A CloseOnceInputStream contains some other input stream, which
it uses as its basic source of data. The class
CloseOnceInputStream 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 InputStream that don't allow
close() to be called multiple times.
in| Constructor and Description |
|---|
CloseOnceInputStream(T source)
Construct a
CloseOnceInputStream that forwards the calls
to the source InputStream passed in the constructor. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
getCloseCount()
Returns the number of time that close was called.
|
T |
getWrappedInputStream()
Returns the wrapped (original)
InputStream passed in the
constructor. |
available, mark, markSupported, read, read, read, reset, skippublic CloseOnceInputStream(T source)
CloseOnceInputStream that forwards the calls
to the source InputStream passed in the constructor.source - original InputStreampublic 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 FilterInputStreamIOExceptionpublic int getCloseCount()
DiagnosticInputStreampublic T getWrappedInputStream()
Returns the wrapped (original) InputStream passed in the
constructor.
InputStream passed in the constructorCopyright © 2008–2016. All rights reserved.