Class CloseInCleanupInputStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class CloseInCleanupInputStream
    extends FilterInputStream
    This stream ensures post-mortem clean-up of resources by closing the wrapped input stream. This is only intended as a failsafe. Streams should always be closed explicitly!

    Subclasses may register additional clean-up tasks via cleanup.

    • Field Detail

      • cleanup

        protected final Cleanup<IOException> cleanup
        The clean-up for closing the wrapped input stream as post-mortem action of this CloseInCleanupInputStream.
    • Constructor Detail

      • CloseInCleanupInputStream

        public CloseInCleanupInputStream​(InputStream in)
        Creates a new stream that ensures post-mortem clean-up of the designated stream.
        Parameters:
        in - The wrapped stream.