Class MyLzwDecompressor
- java.lang.Object
-
- org.apache.commons.imaging.common.mylzw.MyLzwDecompressor
-
public final class MyLzwDecompressor extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
MyLzwDecompressor.Listener
-
Field Summary
Fields Modifier and Type Field Description private java.nio.ByteOrder
byteOrder
private int
clearCode
private int
codes
private int
codeSize
private int
eoiCode
private int
initialCodeSize
private MyLzwDecompressor.Listener
listener
private static int
MAX_TABLE_SIZE
private byte[][]
table
private boolean
tiffLZWMode
private int
written
-
Constructor Summary
Constructors Constructor Description MyLzwDecompressor(int initialCodeSize, java.nio.ByteOrder byteOrder)
MyLzwDecompressor(int initialCodeSize, java.nio.ByteOrder byteOrder, MyLzwDecompressor.Listener listener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addStringToTable(byte[] bytes)
private byte[]
appendBytes(byte[] bytes, byte b)
private void
checkCodeSize()
private void
clearTable()
byte[]
decompress(java.io.InputStream is, int expectedLength)
private byte
firstChar(byte[] bytes)
private int
getNextCode(MyBitInputStream is)
private void
incrementCodeSize()
private void
initializeTable()
private boolean
isInTable(int code)
void
setTiffLZWMode()
private byte[]
stringFromCode(int code)
private void
writeToResult(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 boolean tiffLZWMode
-
-
Constructor Detail
-
MyLzwDecompressor
public MyLzwDecompressor(int initialCodeSize, java.nio.ByteOrder byteOrder)
-
MyLzwDecompressor
public MyLzwDecompressor(int initialCodeSize, java.nio.ByteOrder byteOrder, MyLzwDecompressor.Listener listener)
-
-
Method Detail
-
initializeTable
private void initializeTable()
-
clearTable
private void clearTable()
-
getNextCode
private int getNextCode(MyBitInputStream is) throws java.io.IOException
- Throws:
java.io.IOException
-
stringFromCode
private byte[] stringFromCode(int code) throws java.io.IOException
- Throws:
java.io.IOException
-
isInTable
private boolean isInTable(int code)
-
firstChar
private byte firstChar(byte[] bytes)
-
addStringToTable
private void addStringToTable(byte[] bytes) throws java.io.IOException
- Throws:
java.io.IOException
-
appendBytes
private byte[] appendBytes(byte[] bytes, byte b)
-
writeToResult
private void writeToResult(java.io.OutputStream os, byte[] bytes) throws java.io.IOException
- Throws:
java.io.IOException
-
setTiffLZWMode
public void setTiffLZWMode()
-
decompress
public byte[] decompress(java.io.InputStream is, int expectedLength) throws java.io.IOException
- Throws:
java.io.IOException
-
checkCodeSize
private void checkCodeSize()
-
incrementCodeSize
private void incrementCodeSize()
-
-