org.apache.fop.pdf

## Class FlateFilter

- java.lang.Object
- - org.apache.fop.pdf.PDFFilter
  - - org.apache.fop.pdf.FlateFilter

-     public class FlateFilter
      extends PDFFilter

  A filter to deflate a stream.

  Note that the attributes for prediction, colors, bitsPerComponent, and columns are not supported when this filter is used to handle the data compression. They are only valid for externally encoded data such as that from a graphics file.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `PREDICTION_NONE` The supported mode when this filter is used for data compression
    `static int` | `PREDICTION_PNG_AVG` Mode for externally encoded data.
    `static int` | `PREDICTION_PNG_NONE` Mode for externally encoded data.
    `static int` | `PREDICTION_PNG_OPT` Mode for externally encoded data.
    `static int` | `PREDICTION_PNG_PAETH` Mode for externally encoded data.
    `static int` | `PREDICTION_PNG_SUB` Mode for externally encoded data.
    `static int` | `PREDICTION_PNG_UP` Mode for externally encoded data.
    `static int` | `PREDICTION_TIFF2` Mode for externally encoded data.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FlateFilter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `OutputStream` | `applyFilter(OutputStream out)` Applies a filter to an OutputStream.
    `int` | `getBitsPerComponent()` Get the number of bits per component.
    `int` | `getColors()` Get the colors for this filter.
    `int` | `getColumns()` Get the number of columns for this filter.
    `PDFObject` | `getDecodeParms()` Get the decode params for this filter.
    `String` | `getName()` Get the name of this filter.
    `int` | `getPredictor()` Get the predictor for this filter.
    `void` | `setBitsPerComponent(int bits)` Set the number of bits per component.
    `void` | `setColors(int colors)` Set the colors for this filter.
    `void` | `setColumns(int columns)` Set the number of columns for this filter.
    `void` | `setPredictor(int predictor)` Set the predictor for this filter.

    - ### Methods inherited from class org.apache.fop.pdf.PDFFilter

      `isApplied, isASCIIFilter, setApplied`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### PREDICTION_NONE

          public static final int PREDICTION_NONE

      The supported mode when this filter is used for data compression
      See Also:
        Constant Field Values

    - #### PREDICTION_TIFF2

          public static final int PREDICTION_TIFF2

      Mode for externally encoded data.
      See Also:
        Constant Field Values

    - #### PREDICTION_PNG_NONE

          public static final int PREDICTION_PNG_NONE

      Mode for externally encoded data.
      See Also:
        Constant Field Values

    - #### PREDICTION_PNG_SUB

          public static final int PREDICTION_PNG_SUB

      Mode for externally encoded data.
      See Also:
        Constant Field Values

    - #### PREDICTION_PNG_UP

          public static final int PREDICTION_PNG_UP

      Mode for externally encoded data.
      See Also:
        Constant Field Values

    - #### PREDICTION_PNG_AVG

          public static final int PREDICTION_PNG_AVG

      Mode for externally encoded data.
      See Also:
        Constant Field Values

    - #### PREDICTION_PNG_PAETH

          public static final int PREDICTION_PNG_PAETH

      Mode for externally encoded data.
      See Also:
        Constant Field Values

    - #### PREDICTION_PNG_OPT

          public static final int PREDICTION_PNG_OPT

      Mode for externally encoded data.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### FlateFilter

          public FlateFilter()

  - ### Method Detail

    - #### getName

          public String getName()

      Get the name of this filter.
      Specified by:
        `getName` in class `PDFFilter`
      Returns:
        the pdf name of the flate decode filter

    - #### getDecodeParms

          public PDFObject getDecodeParms()

      Get the decode params for this filter.
      Specified by:
        `getDecodeParms` in class `PDFFilter`
      Returns:
        a string containing the decode params for this filter

    - #### setPredictor

          public void setPredictor(int predictor)
                            throws PDFFilterException

      Set the predictor for this filter.
      Parameters:
        `predictor` - the predictor to use
      Throws:
        `PDFFilterException` - if there is an error with the predictor

    - #### getPredictor

          public int getPredictor()

      Get the predictor for this filter.
      Returns:
        the predictor used for this filter

    - #### setColors

          public void setColors(int colors)
                         throws PDFFilterException

      Set the colors for this filter.
      Parameters:
        `colors` - the colors to use
      Throws:
        `PDFFilterException` - if predictor is not PREDICTION_NONE

    - #### getColors

          public int getColors()

      Get the colors for this filter.
      Returns:
        the colors for this filter

    - #### setBitsPerComponent

          public void setBitsPerComponent(int bits)
                                   throws PDFFilterException

      Set the number of bits per component.
      Parameters:
        `bits` - the number of bits per component
      Throws:
        `PDFFilterException` - if predictor is not PREDICTION_NONE

    - #### getBitsPerComponent

          public int getBitsPerComponent()

      Get the number of bits per component.
      Returns:
        the number of bits per component

    - #### setColumns

          public void setColumns(int columns)
                          throws PDFFilterException

      Set the number of columns for this filter.
      Parameters:
        `columns` - the number of columns to use for the filter
      Throws:
        `PDFFilterException` - if predictor is not PREDICTION_NONE

    - #### getColumns

          public int getColumns()

      Get the number of columns for this filter.
      Returns:
        the number of columns

    - #### applyFilter

          public OutputStream applyFilter(OutputStream out)
                                   throws IOException

      Applies a filter to an OutputStream.
      Specified by:
        `applyFilter` in class `PDFFilter`
      Parameters:
        `out` - contents to be filtered
      Returns:
        OutputStream filtered contents
      Throws:
        `IOException` - In case of an I/O problem

Copyright © 2025 Apache Software Foundation. All rights reserved.