org.apache.pdfbox.filter

## Class LZWFilter

- java.lang.Object
- - org.apache.pdfbox.filter.Filter
  - - org.apache.pdfbox.filter.LZWFilter

    public class LZWFilter
    extends Filter

This is the filter used for the LZWDecode filter.

Author:
  Ben Litchfield, Tilman Hausherr

### Field Summary

Fields
`static long` `CLEAR_TABLE` The LZW clear table code.
`static long` `EOD` The LZW end of data code.

### Fields inherited from class org.apache.pdfbox.filter.Filter

`SYSPROP_CCITTFAX_MAXBYTES, SYSPROP_DEFLATELEVEL`

### Constructor Summary

Constructors
Constructor and Description
`LZWFilter()`

### Method Summary

All Methods Instance Methods Concrete Methods
`DecodeResult` `decode(InputStream encoded, OutputStream decoded, COSDictionary parameters, int index)` Decodes data, producing the original non-encoded data.
`protected void` `encode(InputStream rawData, OutputStream encoded, COSDictionary parameters)`

### Methods inherited from class org.apache.pdfbox.filter.Filter

`decode, decode, encode, findImageReader, findRasterReader, getCompressionLevel, getDecodeParams`

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

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

### Field Detail

#### CLEAR_TABLE

    public static final long CLEAR_TABLE

The LZW clear table code.

See Also:
  Constant Field Values

#### EOD

    public static final long EOD

The LZW end of data code.

See Also:
  Constant Field Values

### Constructor Detail

#### LZWFilter

    public LZWFilter()

### Method Detail

#### decode

    public DecodeResult decode(InputStream encoded,
                               OutputStream decoded,
                               COSDictionary parameters,
                               int index)
                        throws IOException

Decodes data, producing the original non-encoded data.

Specified by:
  `decode` in class `Filter`
Parameters:
  `encoded` - the encoded byte stream
  `decoded` - the stream where decoded data will be written
  `parameters` - the parameters used for decoding
  `index` - the index to the filter being decoded
Returns:
  repaired parameters dictionary, or the original parameters dictionary
Throws:
  `IOException` - if the stream cannot be decoded

#### encode

    protected void encode(InputStream rawData,
                          OutputStream encoded,
                          COSDictionary parameters)
                   throws IOException

Specified by:
  `encode` in class `Filter`
Throws:
  `IOException`