Class UncloseableInputStream

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

    public class UncloseableInputStream
    extends java.io.FilterInputStream
    A wrapper for an input stream to avoid allowing libraries to close input streams unexpectedly using the close() method. Instead, they must be closed by the creator using doClose().
    • Field Summary

      • Fields inherited from class java.io.FilterInputStream

        in
    • Constructor Summary

      Constructors 
      Constructor Description
      UncloseableInputStream​(java.io.InputStream parent)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void doClose()
      Invoke close on FilterInputStream parent class.
      • Methods inherited from class java.io.FilterInputStream

        available, mark, markSupported, read, read, read, reset, skip
      • 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

      • UncloseableInputStream

        public UncloseableInputStream​(java.io.InputStream parent)
        Constructor
        Parameters:
        parent - 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.FilterInputStream
        Throws:
        java.io.IOException
      • doClose

        public void doClose()
                     throws java.io.IOException
        Invoke close on FilterInputStream parent class.
        Throws:
        java.io.IOException