Package com.itextpdf.text.pdf.codec
Class LZWCompressor
- java.lang.Object
-
- com.itextpdf.text.pdf.codec.LZWCompressor
-
public class LZWCompressor extends java.lang.Object
Modified from original LZWCompressor to change interface to passing a buffer of data to be compressed.- Since:
- 5.0.2
-
-
Field Summary
Fields Modifier and Type Field Description (package private) BitFile
bf_
output destination for bit codes(package private) int
clearCode_
reserved clear code based on code size(package private) int
codeSize_
base underlying code size of data being compressed 8 for TIFF, 1 to 8 for GIF(package private) int
endOfInfo_
reserved end of data code based on code size(package private) int
limit_
limit at which current number of bits code size has to be increased(package private) LZWStringTable
lzss_
general purpose LZW string table(package private) int
numBits_
current number bits output for each code(package private) short
prefix_
the prefix code which represents the predecessor string to current input point(package private) boolean
tiffFudge_
modify the limits of the code values in LZW encoding due to TIFF bug / feature
-
Constructor Summary
Constructors Constructor Description LZWCompressor(java.io.OutputStream out, int codeSize, boolean TIFF)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
compress(byte[] buf, int offset, int length)
void
flush()
Indicate to compressor that no more data to go so write out any remaining buffered data.
-
-
-
Field Detail
-
codeSize_
int codeSize_
base underlying code size of data being compressed 8 for TIFF, 1 to 8 for GIF
-
clearCode_
int clearCode_
reserved clear code based on code size
-
endOfInfo_
int endOfInfo_
reserved end of data code based on code size
-
numBits_
int numBits_
current number bits output for each code
-
limit_
int limit_
limit at which current number of bits code size has to be increased
-
prefix_
short prefix_
the prefix code which represents the predecessor string to current input point
-
bf_
BitFile bf_
output destination for bit codes
-
lzss_
LZWStringTable lzss_
general purpose LZW string table
-
tiffFudge_
boolean tiffFudge_
modify the limits of the code values in LZW encoding due to TIFF bug / feature
-
-
Constructor Detail
-
LZWCompressor
public LZWCompressor(java.io.OutputStream out, int codeSize, boolean TIFF) throws java.io.IOException
- Parameters:
out
- destination for compressed datacodeSize
- the initial code size for the LZW compressorTIFF
- flag indicating that TIFF lzw fudge needs to be applied- Throws:
java.io.IOException
- if underlying output stream error
-
-
Method Detail
-
compress
public void compress(byte[] buf, int offset, int length) throws java.io.IOException
- Parameters:
buf
- data to be compressed to output stream- Throws:
java.io.IOException
- if underlying output stream error
-
flush
public void flush() throws java.io.IOException
Indicate to compressor that no more data to go so write out any remaining buffered data.- Throws:
java.io.IOException
- if underlying output stream error
-
-