Class MyLzwCompressor
java.lang.Object
org.apache.commons.imaging.mylzw.MyLzwCompressor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteOrderprivate final intprivate intprivate intprivate final booleanprivate final intprivate final intprivate final MyLzwCompressor.Listenerprivate final Map<MyLzwCompressor.ByteArray, Integer> -
Constructor Summary
ConstructorsConstructorDescriptionMyLzwCompressor(int initialCodeSize, ByteOrder byteOrder, boolean earlyLimit) MyLzwCompressor(int initialCodeSize, ByteOrder byteOrder, boolean earlyLimit, MyLzwCompressor.Listener listener) -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanaddTableEntry(MyBitOutputStream bos, byte[] bytes, int start, int length) private booleanprivate MyLzwCompressor.ByteArrayarrayToKey(byte b) private MyLzwCompressor.ByteArrayarrayToKey(byte[] bytes, int start, int length) private voidprivate intcodeFromString(byte[] bytes, int start, int length) byte[]compress(byte[] bytes) private voidprivate voidprivate booleanisInTable(byte[] bytes, int start, int length) private voidprivate voidwriteCode(MyBitOutputStream bos, int code) private voidwriteDataCode(MyBitOutputStream bos, int code) private void
-
Field Details
-
codeSize
private int codeSize -
initialCodeSize
private final int initialCodeSize -
codes
private int codes -
byteOrder
-
earlyLimit
private final boolean earlyLimit -
clearCode
private final int clearCode -
eoiCode
private final int eoiCode -
listener
-
map
-
-
Constructor Details
-
MyLzwCompressor
-
MyLzwCompressor
public MyLzwCompressor(int initialCodeSize, ByteOrder byteOrder, boolean earlyLimit, MyLzwCompressor.Listener listener)
-
-
Method Details
-
addTableEntry
private boolean addTableEntry(MyBitOutputStream bos, byte[] bytes, int start, int length) throws IOException - Throws:
IOException
-
addTableEntry
private boolean addTableEntry(MyBitOutputStream bos, MyLzwCompressor.ByteArray key) throws IOException - Throws:
IOException
-
arrayToKey
-
arrayToKey
-
clearTable
private void clearTable() -
codeFromString
- Throws:
ImagingException
-
compress
- Throws:
IOException
-
incrementCodeSize
private void incrementCodeSize() -
initializeStringTable
private void initializeStringTable() -
isInTable
private boolean isInTable(byte[] bytes, int start, int length) -
writeClearCode
- Throws:
IOException
-
writeCode
- Throws:
IOException
-
writeDataCode
- Throws:
IOException
-
writeEoiCode
- Throws:
IOException
-