Interface IStreamCompressionStrategy

All Known Implementing Classes:
BrotliStreamCompressionStrategy, FlateCompressionStrategy

public interface IStreamCompressionStrategy
Strategy interface for PDF stream compression implementations.

This interface defines the contract for compression strategies that can be applied to PDF streams. Different compression algorithms can be implemented by providing concrete implementations of this interface.

  • Method Details

    • getFilterName

      PdfName getFilterName()
      Gets the PDF filter name that identifies this compression algorithm.
      Returns:
      the PDF name representing the compression filter
    • getDecodeParams

      PdfObject getDecodeParams()
      Gets the decode parameters required for decompressing the stream.

      Decode parameters provide additional information needed to correctly decompress the stream data. This may include predictor settings, color information, or other algorithm-specific parameters. The returned object is typically a PdfDictionary or PdfArray, or null if no special parameters are required.

      Returns:
      the decode parameters as a PDF object, or null if not needed
    • createNewOutputStream

      OutputStream createNewOutputStream (OutputStream original, PdfStream stream)
      Creates a new output stream that wraps the original stream and applies compression.

      This method wraps the provided output stream with a compression implementation. Data written to the returned stream will be compressed before being written to the original stream.

      If the stream requires finalization (e.g., to flush buffers or write end markers), the returned output stream should also implement the IFinishable interface,

      Parameters:
      original - the original output stream to wrap
      stream - the PDF stream being compressed (may be used for context or configuration)
      Returns:
      a new output stream that performs compression