T - Type of the OutputStream passed in the constructor.public class CloseOnceOutputStream<T extends OutputStream> extends FilterOutputStream
A decorating OutputStream that prevents multiple invocations of
the close() method on 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 non standard OutputStream that don't allow
close() to be called multiple times.
out| Constructor and Description |
|---|
CloseOnceOutputStream(T source)
Construct a
CloseOnceOutputStream that forwards the calls to
the source OutputStream passed in the constructor. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
getCloseCount()
Returns the number of time that close was called.
|
T |
getWrappedOutputStream()
Returns the wrapped (original)
OutputStream passed in the
constructor. |
flush, write, write, writepublic CloseOnceOutputStream(T source)
CloseOnceOutputStream that forwards the calls to
the source OutputStream passed in the constructor.source - original OutputStreampublic 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 FilterOutputStreamIOExceptionpublic int getCloseCount()
com.gc.iotools.stream.is.inspection.DiagnosticOutputStreampublic T getWrappedOutputStream()
Returns the wrapped (original) OutputStream passed in the
constructor.
OutputStream passed in the constructorCopyright © 2008–2016. All rights reserved.