Package org.apache.commons.imaging.mylzw
Class MyLzwDecompressor
- java.lang.Object
-
- org.apache.commons.imaging.mylzw.MyLzwDecompressor
-
public final class MyLzwDecompressor extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceMyLzwDecompressor.Listener
-
Field Summary
Fields Modifier and Type Field Description private java.nio.ByteOrderbyteOrderprivate intclearCodeprivate intcodesprivate intcodeSizeprivate inteoiCodeprivate intinitialCodeSizeprivate MyLzwDecompressor.Listenerlistenerprivate static intMAX_TABLE_SIZEprivate byte[][]tableprivate booleantiffLZWModeprivate intwritten
-
Constructor Summary
Constructors Constructor Description MyLzwDecompressor(int initialCodeSize, java.nio.ByteOrder byteOrder, boolean tiffLZWMode)MyLzwDecompressor(int initialCodeSize, java.nio.ByteOrder byteOrder, boolean tiffLZWMode, MyLzwDecompressor.Listener listener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddStringToTable(byte[] bytes)private byte[]appendBytes(byte[] bytes, byte b)private voidcheckCodeSize()private voidclearTable()byte[]decompress(java.io.InputStream is, int expectedLength)private bytefirstChar(byte[] bytes)private intgetNextCode(MyBitInputStream is)private voidincrementCodeSize()private voidinitializeTable()private booleanisInTable(int code)private byte[]stringFromCode(int code)private voidwriteToResult(java.io.OutputStream os, byte[] bytes)
-
-
-
Field Detail
-
MAX_TABLE_SIZE
private static final int MAX_TABLE_SIZE
- See Also:
- Constant Field Values
-
table
private final byte[][] table
-
codeSize
private int codeSize
-
initialCodeSize
private final int initialCodeSize
-
codes
private int codes
-
byteOrder
private final java.nio.ByteOrder byteOrder
-
listener
private final MyLzwDecompressor.Listener listener
-
clearCode
private final int clearCode
-
eoiCode
private final int eoiCode
-
written
private int written
-
tiffLZWMode
private final boolean tiffLZWMode
-
-
Constructor Detail
-
MyLzwDecompressor
public MyLzwDecompressor(int initialCodeSize, java.nio.ByteOrder byteOrder, boolean tiffLZWMode) throws ImagingException- Throws:
ImagingException
-
MyLzwDecompressor
public MyLzwDecompressor(int initialCodeSize, java.nio.ByteOrder byteOrder, boolean tiffLZWMode, MyLzwDecompressor.Listener listener) throws ImagingException- Throws:
ImagingException
-
-
Method Detail
-
addStringToTable
private void addStringToTable(byte[] bytes)
-
appendBytes
private byte[] appendBytes(byte[] bytes, byte b)
-
checkCodeSize
private void checkCodeSize()
-
clearTable
private void clearTable()
-
decompress
public byte[] decompress(java.io.InputStream is, int expectedLength) throws java.io.IOException- Throws:
java.io.IOException
-
firstChar
private byte firstChar(byte[] bytes)
-
getNextCode
private int getNextCode(MyBitInputStream is) throws java.io.IOException
- Throws:
java.io.IOException
-
incrementCodeSize
private void incrementCodeSize()
-
initializeTable
private void initializeTable() throws ImagingException- Throws:
ImagingException
-
isInTable
private boolean isInTable(int code)
-
stringFromCode
private byte[] stringFromCode(int code) throws ImagingException- Throws:
ImagingException
-
writeToResult
private void writeToResult(java.io.OutputStream os, byte[] bytes) throws java.io.IOException- Throws:
java.io.IOException
-
-