Class CloseShieldInputStream

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

    public class CloseShieldInputStream
    extends java.io.PushbackInputStream
    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. JavaDoc copied from the Apache Commons-IO project, with code changed to match our dependencies. file: org.apache.commons.io.input.CloseShieldInputStream.java

    • Field Summary

      • Fields inherited from class java.io.PushbackInputStream

        buf, pos
      • Fields inherited from class java.io.FilterInputStream

        in
    • Constructor Summary

      Constructors 
      Constructor Description
      CloseShieldInputStream​(java.io.InputStream inStream)
      Constructor for CloseShieldInputStream
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void realClose()
      Real close
      • Methods inherited from class java.io.PushbackInputStream

        available, mark, markSupported, read, read, reset, skip, unread, unread, unread
      • Methods inherited from class java.io.FilterInputStream

        read
      • Methods inherited from class java.io.InputStream

        nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CloseShieldInputStream

        public CloseShieldInputStream​(java.io.InputStream inStream)
        Constructor for CloseShieldInputStream
        Parameters:
        inStream - the input stream
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.PushbackInputStream
        Throws:
        java.io.IOException
        See Also:
        FilterInputStream.close()
      • realClose

        public void realClose()
                       throws java.io.IOException
        Real close
        Throws:
        java.io.IOException - In case of an I/O error