? CloseShieldInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.commons.io.input.ProxyInputStream
org.apache.commons.io.input.CloseShieldInputStream
- ????????:
Closeable
,AutoCloseable
Proxy stream that prevents the underlying input stream from being closed.
This class is typically used in cases where an input stream needs to be passed to a component that wants to explicitly close the stream even if more input would still be available to other components.
- ???????:
- 1.4
-
????
??????? java.io.FilterInputStream
in
-
?????
????????CloseShieldInputStream
(InputStream inputStream) ????Using this constructor prevents IDEs from warning if the underlying input stream is never closed. -
????
??????????void
close()
Replaces the underlying input stream with aClosedInputStream
sentinel.static CloseShieldInputStream
wrap
(InputStream inputStream) Creates a proxy that shields the given input stream from being closed.??????? org.apache.commons.io.input.ProxyInputStream
afterRead, available, beforeRead, handleIOException, mark, markSupported, read, read, read, reset, skip
??????? java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
???????
-
CloseShieldInputStream
????Using this constructor prevents IDEs from warning if the underlying input stream is never closed. Usewrap(InputStream)
instead.Creates a proxy that shields the given input stream from being closed.- ??:
inputStream
- underlying input stream
-
-
??????
-
wrap
Creates a proxy that shields the given input stream from being closed.- ??:
inputStream
- the input stream to wrap- ??:
- the created proxy
- ???????:
- 2.9.0
-
close
Replaces the underlying input stream with aClosedInputStream
sentinel. The original input stream will remain open, but this proxy will appear closed.- ???:
close
????AutoCloseable
- ???:
close
????Closeable
- ??:
close
???ProxyInputStream
-