Interface IFinishable

All Known Implementing Classes:
BrotliOutputStream, DeflaterOutputStream

public interface IFinishable
Interface for output streams that supports finalization without closing the underlying stream.

This interface is designed for output streams that wrap other streams and need to complete their processing (such as finishing compression, flushing buffers, or writing final data) without closing the underlying output stream. This is particularly useful when multiple operations need to be performed on the same underlying stream sequentially.

Implementations of this interface should ensure that calling finish() completes all pending operations and releases any resources associated with the stream processing, but does not close the underlying stream.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    finish()
    Is called to finalize the stream, implementing classes should ensure that the underlying output stream remains open after this method is called.
  • Method Details

    • finish

      void finish() throws IOException
      Is called to finalize the stream, implementing classes should ensure that the underlying output stream remains open after this method is called.

      This method completes any pending write operations, flushes internal buffers, writes any final data required by the stream format, and releases resources associated with the stream processing. However, unlike OutputStream.close(), it does not close the underlying output stream.

      After calling this method, no further data should be written to this stream, but the underlying stream remains open and can be used for other operations.

      This method should be idempotent - calling it multiple times should have the same effect as calling it once.

      Throws:
      IOException - if an I/O error occurs during finalization