Package org.apache.tika.io
Class CloseShieldInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.tika.io.ProxyInputStream
org.apache.tika.io.CloseShieldInputStream
- All Implemented Interfaces:
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.
- Since:
- Apache Tika 0.4, copied from Commons IO 1.4
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a proxy that shields the given input stream from being closed. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Replaces the underlying input stream with aClosedInputStreamsentinel.Methods inherited from class org.apache.tika.io.ProxyInputStream
available, mark, markSupported, read, read, read, reset, skipMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
CloseShieldInputStream
Creates a proxy that shields the given input stream from being closed.- Parameters:
in- underlying input stream
-
-
Method Details
-
close
public void close()Replaces the underlying input stream with aClosedInputStreamsentinel. The original input stream will remain open, but this proxy will appear closed.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classProxyInputStream
-