Class CloseInCleanupInputStream

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
de.aristaflow.adept2.util.io.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 Details

    • cleanup

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

    • CloseInCleanupInputStream

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