public class RunLengthCompressionStrategy extends Object implements IStreamCompressionStrategy
RunLengthDecode filter for PDF
streams.
This strategy implements the IStreamCompressionStrategy interface
and provides RunLengthDecode encoding.
Run-length encoding works best, when input data has long sequences of identical bytes. This is, usually, not the case for PDF content streams, so using this strategy will often cause a marginal size increase instead.
| Constructor and Description |
|---|
RunLengthCompressionStrategy()
Constructs a new
RunLengthCompressionStrategy instance. |
| Modifier and Type | Method and Description |
|---|---|
OutputStream |
createNewOutputStream(OutputStream original,
PdfStream stream)
Creates a new output stream with run length compression applied.
|
PdfObject |
getDecodeParams()
Returns the decode parameters for the
RunLengthDecode filter. |
PdfName |
getFilterName()
Returns the name of the compression filter.
|
public RunLengthCompressionStrategy()
RunLengthCompressionStrategy instance.public PdfName getFilterName()
getFilterName in interface IStreamCompressionStrategyPdfName.RunLengthDecode representing the RunLengthDecode filterpublic PdfObject getDecodeParams()
RunLengthDecode filter.
This implementation returns null as no special decode parameters
are required for standard run length compression.
getDecodeParams in interface IStreamCompressionStrategynull as no decode parameters are neededpublic OutputStream createNewOutputStream(OutputStream original, PdfStream stream)
This method wraps the original output stream in a RunLengthOutputStream
that applies run length compression.
createNewOutputStream in interface IStreamCompressionStrategyoriginal - the original output stream to wrapstream - the PDF stream containing compression configurationRunLengthOutputStream that compresses data using the run length algorithmCopyright © 1998–2026 Apryse Group NV. All rights reserved.