Interface IStreamCompressionStrategy
- All Known Implementing Classes:
-
BrotliStreamCompressionStrategy,FlateCompressionStrategy
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 Summary
Modifier and TypeMethodDescriptioncreateNewOutputStream(OutputStream original, PdfStream stream) Creates a new output stream that wraps the original stream and applies compression.Gets the decode parameters required for decompressing the stream.Gets the PDF filter name that identifies this compression algorithm.
-
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
PdfDictionaryorPdfArray, ornullif no special parameters are required.- Returns:
-
the decode parameters as a PDF object, or
nullif not needed
-
createNewOutputStream
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
IFinishableinterface,- 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
-