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.
Constructor and Description |
---|
CloseShieldOutputStream(java.io.OutputStream outputStream)
Deprecated.
Using this constructor prevents IDEs from warning if the
underlying output stream is never closed. Use
wrap(OutputStream) instead. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Replaces the underlying output stream with a
ClosedOutputStream
sentinel. |
static CloseShieldOutputStream |
wrap(java.io.OutputStream outputStream)
Creates a proxy that shields the given output stream from being closed.
|
flush, write, write, write
@Deprecated public CloseShieldOutputStream(java.io.OutputStream outputStream)
wrap(OutputStream)
instead.outputStream
- underlying output streampublic static CloseShieldOutputStream wrap(java.io.OutputStream outputStream)
outputStream
- the output stream to wrappublic void close()
ClosedOutputStream
sentinel. The original output stream will remain open, but this proxy will
appear closed.close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class ProxyOutputStream
Copyright © 2010 - 2023 Adobe. All Rights Reserved