Package com.itextpdf.kernel.pdf.filters
Class LZWDecoder
- java.lang.Object
-
- com.itextpdf.kernel.pdf.filters.LZWDecoder
-
public class LZWDecoder extends java.lang.Object
A class for performing LZW decoding.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int[]
andTable
(package private) int
bitPointer
(package private) int
bitsToGet
(package private) int
bytePointer
(package private) byte[]
data
(package private) int
nextBits
(package private) int
nextData
(package private) byte[][]
stringTable
(package private) int
tableIndex
(package private) java.io.OutputStream
uncompData
-
Constructor Summary
Constructors Constructor Description LZWDecoder()
Creates an LZWDecoder instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addStringToTable(byte[] string)
Add a new string to the string table.void
addStringToTable(byte[] oldString, byte newString)
Add a new string to the string table.byte[]
composeString(byte[] oldString, byte newString)
AppendnewString
to the end ofoldString
.void
decode(byte[] data, java.io.OutputStream uncompData)
Method to decode LZW compressed data.int
getNextCode()
Attempt to get the next code.void
initializeStringTable()
Initialize the string table.void
writeString(byte[] string)
Write out the string just uncompressed.
-
-
-
Method Detail
-
decode
public void decode(byte[] data, java.io.OutputStream uncompData)
Method to decode LZW compressed data.- Parameters:
data
- The compressed data.uncompData
- Array to return the uncompressed data in.
-
initializeStringTable
public void initializeStringTable()
Initialize the string table.
-
writeString
public void writeString(byte[] string)
Write out the string just uncompressed.- Parameters:
string
- content to write to the uncompressed data
-
addStringToTable
public void addStringToTable(byte[] oldString, byte newString)
Add a new string to the string table.- Parameters:
oldString
- stored stringnewString
- string to be appended to the stored string
-
addStringToTable
public void addStringToTable(byte[] string)
Add a new string to the string table.- Parameters:
string
- byte[] to store in the string table
-
composeString
public byte[] composeString(byte[] oldString, byte newString)
AppendnewString
to the end ofoldString
.- Parameters:
oldString
- string be appended tonewString
- string that is to be appended to oldString- Returns:
- combined string
-
getNextCode
public int getNextCode()
Attempt to get the next code. Exceptions are caught to make this robust to cases wherein the EndOfInformation code has been omitted from a strip. Examples of such cases have been observed in practice.- Returns:
- next code
-
-