Package net.sf.jazzlib
Class DeflaterEngine
java.lang.Object
net.sf.jazzlib.DeflaterEngine
- All Implemented Interfaces:
DeflaterConstants
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Adler32The adler checksumprivate intprivate intThe current compression function.private intprivate final short[]Hashtable, hashing three characters to an index for window, so that window[index]..window[index+2] have this hash code.private final DeflaterHuffmanprivate byte[]The input data for compression.private intThe end offset of the input data.private intThe offset into inputBuf, where input data starts.private intprivate intlookahead is the number of characters starting at strstart in window that are valid.private intprivate intprivate intprivate intprivate intprivate final DeflaterPendingprivate final short[]prev[index invalid input: '&' WMASK] points to the previous index that has the same hash code as the string starting at index.private booleanprivate intprivate intstrstart points to the current character in window.private static final intprivate intThe total bytes of input read.private final byte[]This array contains the part of the uncompressed stream that is of relevance.Fields inherited from interface net.sf.jazzlib.DeflaterConstants
COMPR_FUNC, DEBUGGING, DEFAULT_MEM_LEVEL, DEFLATE_FAST, DEFLATE_SLOW, DEFLATE_STORED, DYN_TREES, GOOD_LENGTH, HASH_BITS, HASH_MASK, HASH_SHIFT, HASH_SIZE, MAX_BLOCK_SIZE, MAX_CHAIN, MAX_DIST, MAX_LAZY, MAX_MATCH, MAX_WBITS, MIN_LOOKAHEAD, MIN_MATCH, NICE_LENGTH, PENDING_BUF_SIZE, PRESET_DICT, STATIC_TREES, STORED_BLOCK, WMASK, WSIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandeflate(boolean flush, boolean finish) private booleandeflateFast(boolean flush, boolean finish) private booleandeflateSlow(boolean flush, boolean finish) private booleandeflateStored(boolean flush, boolean finish) private voidFill the window when the lookahead becomes insufficient.private booleanfindLongestMatch(int curMatch) Find the best (longest) string in the window matching the string starting at strstart.final intgetAdler()final intprivate final intInserts the current string in the head hash and returns the previous value for this hash.final booleanvoidreset()final void(package private) voidsetDictionary(byte[] buffer, int offset, int length) voidsetInput(byte[] buf, int off, int len) voidsetLevel(int lvl) final voidsetStrategy(int strat) private voidprivate final void
-
Field Details
-
TOO_FAR
private static final int TOO_FAR- See Also:
-
ins_h
private int ins_h -
head
private final short[] headHashtable, hashing three characters to an index for window, so that window[index]..window[index+2] have this hash code. Note that the array should really be unsigned short, so you need to and the values with 0xffff. -
prev
private final short[] prevprev[index invalid input: '&' WMASK] points to the previous index that has the same hash code as the string starting at index. This way entries with the same hash code are in a linked list. Note that the array should really be unsigned short, so you need to and the values with 0xffff. -
matchStart
private int matchStart -
matchLen
private int matchLen -
prevAvailable
private boolean prevAvailable -
blockStart
private int blockStart -
strstart
private int strstartstrstart points to the current character in window. -
lookahead
private int lookaheadlookahead is the number of characters starting at strstart in window that are valid. So window[strstart] until window[strstart+lookahead-1] are valid characters. -
window
private final byte[] windowThis array contains the part of the uncompressed stream that is of relevance. The current character is indexed by strstart. -
strategy
private int strategy -
max_chain
private int max_chain -
max_lazy
private int max_lazy -
niceLength
private int niceLength -
goodLength
private int goodLength -
comprFunc
private int comprFuncThe current compression function. -
inputBuf
private byte[] inputBufThe input data for compression. -
totalIn
private int totalInThe total bytes of input read. -
inputOff
private int inputOffThe offset into inputBuf, where input data starts. -
inputEnd
private int inputEndThe end offset of the input data. -
pending
-
huffman
-
adler
The adler checksum
-
-
Constructor Details
-
DeflaterEngine
DeflaterEngine(DeflaterPending pending)
-
-
Method Details
-
reset
public void reset() -
resetAdler
public final void resetAdler() -
getAdler
public final int getAdler() -
getTotalIn
public final int getTotalIn() -
setStrategy
public final void setStrategy(int strat) -
setLevel
public void setLevel(int lvl) -
updateHash
private final void updateHash() -
insertString
private final int insertString()Inserts the current string in the head hash and returns the previous value for this hash. -
slideWindow
private void slideWindow() -
fillWindow
private void fillWindow()Fill the window when the lookahead becomes insufficient. Updates strstart and lookahead. OUT assertions: strstart + lookahead invalid input: '<'= 2*WSIZE lookahead >= MIN_LOOKAHEAD or inputOff == inputEnd -
findLongestMatch
private boolean findLongestMatch(int curMatch) Find the best (longest) string in the window matching the string starting at strstart. Preconditions: strstart + MAX_MATCH invalid input: '<'= window.length.- Parameters:
curMatch-
-
setDictionary
void setDictionary(byte[] buffer, int offset, int length) -
deflateStored
private boolean deflateStored(boolean flush, boolean finish) -
deflateFast
private boolean deflateFast(boolean flush, boolean finish) -
deflateSlow
private boolean deflateSlow(boolean flush, boolean finish) -
deflate
public boolean deflate(boolean flush, boolean finish) -
setInput
public void setInput(byte[] buf, int off, int len) -
needsInput
public final boolean needsInput()
-