Class DelegatedCloseableInputStream

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

    public class DelegatedCloseableInputStream
    extends java.io.FilterInputStream
    An input stream which will run a supplied runnable when the input stream is closed.
    • Field Summary

      • Fields inherited from class java.io.FilterInputStream

        in
    • Constructor Summary

      Constructors 
      Constructor Description
      DelegatedCloseableInputStream​(java.io.InputStream in, java.lang.Runnable closeFunction)
      Constructs an input stream which wraps the supplied input stream and runs the supplied runnable when the input stream is closed.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      • 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

      • DelegatedCloseableInputStream

        public DelegatedCloseableInputStream​(java.io.InputStream in,
                                             java.lang.Runnable closeFunction)
        Constructs an input stream which wraps the supplied input stream and runs the supplied runnable when the input stream is closed.
        Parameters:
        in - the input stream to wrap
        closeFunction - the runnable to run when the input stream is closed
    • 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