public class CloseShieldOutputStream extends ProxyOutputStream
This class is typically used in cases where an output stream needs to be passed to a component that wants to explicitly close the stream even if other components would still use the stream for output.
ProxyOutputStream.Builderout| Modifier and Type | Method and Description |
|---|---|
void |
close()
Replaces the underlying output stream with a
ClosedOutputStream
sentinel. |
static CloseShieldOutputStream |
wrap(OutputStream outputStream)
Constructs a proxy that shields the given output stream from being closed.
|
afterWrite, beforeWrite, flush, handleIOException, setReference, unwrap, write, write, writepublic void close()
ClosedOutputStream
sentinel. The original output stream will remain open, but this proxy will
appear closed.close in interface Closeableclose in interface AutoCloseableclose in class ProxyOutputStreampublic static CloseShieldOutputStream wrap(OutputStream outputStream)
outputStream - the output stream to wrap