public abstract class InternalLZWInputStream extends CompressorInputStream
Base-class for traditional Unix ".Z" compression and the Unshrinking method of ZIP archive.
| Modifier and Type | Field and Description |
|---|---|
protected int |
bitsCached |
protected int |
bitsCachedSize |
protected byte[] |
characters |
protected int |
clearCode |
protected int |
codeSize |
protected java.io.InputStream |
in |
protected int[] |
prefixes |
protected int |
previousCode |
protected int |
tableSize |
| Modifier | Constructor and Description |
|---|---|
protected |
InternalLZWInputStream(java.io.InputStream inputStream) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract int |
addEntry(int previousCode,
byte character)
Add a new entry to the dictionary.
|
protected int |
addEntry(int previousCode,
byte character,
int maxTableSize)
Adds a new entry if the maximum table size hasn't been exceeded
and returns the new index.
|
protected int |
addRepeatOfPreviousCode()
Add entry for repeat of previousCode we haven't added, yet.
|
void |
close() |
protected abstract int |
decompressNextSymbol()
Read the next code and expand it.
|
protected int |
expandCodeToOutputStack(int code,
boolean addedUnfinishedEntry)
Expands the entry with index code to the output stack and may
create a new entry
|
protected void |
initializeTables(int maxCodeSize)
Initializes the arrays based on the maximum code size.
|
int |
read() |
int |
read(byte[] b,
int off,
int len) |
protected int |
readNextCode()
Reads the next code from the stream.
|
protected void |
setClearCode(int codeSize)
Sets the clear code based on the code size.
|
count, count, getBytesRead, getCount, pushedBackBytesprotected final java.io.InputStream in
protected int clearCode
protected int codeSize
protected int bitsCached
protected int bitsCachedSize
protected int previousCode
protected int tableSize
protected int[] prefixes
protected byte[] characters
protected InternalLZWInputStream(java.io.InputStream inputStream)
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOExceptionpublic int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionprotected abstract int decompressNextSymbol()
throws java.io.IOException
java.io.IOExceptionprotected abstract int addEntry(int previousCode,
byte character)
throws java.io.IOException
java.io.IOExceptionprotected void setClearCode(int codeSize)
protected void initializeTables(int maxCodeSize)
protected int readNextCode()
throws java.io.IOException
java.io.IOExceptionprotected int addEntry(int previousCode,
byte character,
int maxTableSize)
protected int addRepeatOfPreviousCode()
throws java.io.IOException
java.io.IOExceptionprotected int expandCodeToOutputStack(int code,
boolean addedUnfinishedEntry)
throws java.io.IOException
java.io.IOException