Package com.itextpdf.io.codec
Class LZWCompressor
- java.lang.Object
-
- com.itextpdf.io.codec.LZWCompressor
-
public class LZWCompressor extends java.lang.ObjectModified from original LZWCompressor to change interface to passing a buffer of data to be compressed.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) BitFilebf_output destination for bit codes(package private) intclearCode_reserved clear code based on code size(package private) intcodeSize_base underlying code size of data being compressed 8 for TIFF, 1 to 8 for GIF(package private) intendOfInfo_reserved end of data code based on code size(package private) intlimit_limit at which current number of bits code size has to be increased(package private) LZWStringTablelzss_general purpose LZW string table(package private) intnumBits_current number bits output for each code(package private) shortprefix_the prefix code which represents the predecessor string to current input point(package private) booleantiffFudge_modify the limits of the code values in LZW encoding due to TIFF bug / feature
-
Constructor Summary
Constructors Constructor Description LZWCompressor(java.io.OutputStream outputStream, int codeSize, boolean TIFF)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcompress(byte[] buf, int offset, int length)voidflush()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 outputStream, int codeSize, boolean TIFF) throws java.io.IOException- 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:
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- The data to be compressed to output streamoffset- The offset at which the data startslength- The length of the data being compressed- Throws:
java.io.IOException- if underlying output stream error
-
flush
public void flush() throws java.io.IOExceptionIndicate to compressor that no more data to go so write out any remaining buffered data.- Throws:
java.io.IOException- if underlying output stream error
-
-