? CloseShieldOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.apache.commons.io.output.ProxyOutputStream
org.apache.commons.io.output.CloseShieldOutputStream
- ????????:
Closeable
,Flushable
,AutoCloseable
Proxy stream that prevents the underlying output stream from being closed.
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.
- ???????:
- 1.4
-
????
??????? java.io.FilterOutputStream
out
-
?????
????????CloseShieldOutputStream
(OutputStream outputStream) ????Using this constructor prevents IDEs from warning if the underlying output stream is never closed. -
????
??????????void
close()
Replaces the underlying output stream with aClosedOutputStream
sentinel.static CloseShieldOutputStream
wrap
(OutputStream outputStream) Creates a proxy that shields the given output stream from being closed.??????? org.apache.commons.io.output.ProxyOutputStream
afterWrite, beforeWrite, flush, handleIOException, write, write, write
??????? java.io.OutputStream
nullOutputStream
-
???????
-
CloseShieldOutputStream
????Using this constructor prevents IDEs from warning if the underlying output stream is never closed. Usewrap(OutputStream)
instead.Creates a proxy that shields the given output stream from being closed.- ??:
outputStream
- underlying output stream
-
-
??????
-
wrap
Creates a proxy that shields the given output stream from being closed.- ??:
outputStream
- the output stream to wrap- ??:
- the created proxy
- ???????:
- 2.9.0
-
close
Replaces the underlying output stream with aClosedOutputStream
sentinel. The original output stream will remain open, but this proxy will appear closed.- ???:
close
????AutoCloseable
- ???:
close
????Closeable
- ??:
close
???ProxyOutputStream
-