Class LZWCompressor
java.lang.Object
com.itextpdf.io.codec.LZWCompressor
Modified from original LZWCompressor to change interface to passing a
buffer of data to be compressed.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) BitFileoutput destination for bit codes(package private) intreserved clear code based on code size(package private) intbase underlying code size of data being compressed 8 for TIFF, 1 to 8 for GIF(package private) intreserved end of data code based on code size(package private) intlimit at which current number of bits code size has to be increased(package private) LZWStringTablegeneral purpose LZW string table(package private) intcurrent number bits output for each code(package private) shortthe prefix code which represents the predecessor string to current input point(package private) booleanmodify the limits of the code values in LZW encoding due to TIFF bug / feature -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
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 Details
-
LZWCompressor
- Parameters:
outputStream- destination for compressed datacodeSize- the initial code size for the LZW compressorTIFF- flag indicating that TIFF lzw fudge needs to be applied- Throws:
IOException- if underlying output stream error
-
-
Method Details
-
compress
- Parameters:
buf- The data to be compressed to output streamoffset- The offset at which the data startslength- The length of the data being compressed- Throws:
IOException- if underlying output stream error
-
flush
Indicate to compressor that no more data to go so write out any remaining buffered data.- Throws:
IOException- if underlying output stream error
-