Class CloseShieldInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class CloseShieldInputStream
    extends ProxyInputStream
    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

      Constructors 
      Constructor Description
      CloseShieldInputStream​(java.io.InputStream in)
      Creates a proxy that shields the given input stream from being closed.
    • Constructor Detail

      • CloseShieldInputStream

        public CloseShieldInputStream​(java.io.InputStream in)
        Creates a proxy that shields the given input stream from being closed.
        Parameters:
        in - underlying input stream
    • Method Detail

      • close

        public void close()
        Replaces the underlying input stream with a ClosedInputStream sentinel. The original input stream will remain open, but this proxy will appear closed.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class ProxyInputStream