| Modifier and Type | Field and Description |
|---|---|
| pack-priv final byte[] | |
| pack-priv final int | |
| private boolean | |
| private final int | keepSizeAfter
Number of bytes that must be available, the current byte included, to make hasEnoughData return true. |
| private final int | keepSizeBefore
Number of bytes to keep available before the current byte when moving the LZ window. |
| pack-priv final int | |
| public static final int | |
| public static final int | |
| pack-priv final int | |
| private int | |
| private int | |
| pack-priv int | |
| private int |
| Access | Constructor and Description |
|---|---|
| pack-priv | LZEncoder(int dictSize, int extraSizeBefore, int extraSizeAfter, int niceLen, int matchLenMax, ArrayCache arrayCache)
Creates a new LZEncoder. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public int | |
| public int | |
| private static int | getBufSize(int dictSize, int extraSizeBefore, int extraSizeAfter, int matchLenMax)
Gets the size of the LZ window buffer that needs to be allocated. |
| public int | |
| public int | |
| public static LZEncoder | getInstance(int
dictionary size dictSize, int number of bytes to keep available in the
history in addition to dictSize extraSizeBefore, int number of bytes that must be available
after current position + matchLenMax extraSizeAfter, int if a match of at least niceLen, int niceLen
bytes is found, be happy with it and don't
stop looking for longer matchesdon't test for matches longer than
matchLenMax, int matchLenMax bytesmatch finder ID mf, int match finder search depth limit depthLimit, ArrayCache arrayCache)Creates a new LZEncoder. |
| public abstract Matches | |
| public int | Returns: length of the match; it is in the range [0, lenLimit]zero-based distance of the match to test dist, int don't test for a match longer than this lenLimit)Get the length of a match at the given distance. |
| public int | Returns: length of the match; it is in the range [0, lenLimit]forward offset forward, int zero-based distance of the match to test dist, int don't test for a match longer than this lenLimit)Get the length of a match at the given distance and forward offset. |
| public static int | getMemoryUsage(int dictSize, int extraSizeBefore, int extraSizeAfter, int matchLenMax, int mf)
Gets approximate memory usage of the LZEncoder base structure and the match finder as kibibytes. |
| public int | |
| public boolean | hasEnoughData(int alreadyReadLen)
Tests if there is enough input available to let the caller encode at least one more byte. |
| public boolean | |
| pack-priv int | Returns: the number of bytes available or zero if there is not enough input availableminimum number of available bytes when
flushing; encoding may be continued with
new input after flushing requiredForFlushing, int minimum number of available bytes when
finishing; encoding must not be continued
after finishing or the match finder state
may be corrupt requiredForFinishing)Moves to the next byte, checks if there is enough input available, and returns the amount of input available. |
| private void | moveWindow()
Moves data from the end of the buffer to the beginning, discarding old data and making space for new input. |
| pack-priv static void | |
| private void | processPendingBytes()
Process pending bytes remaining from preset dictionary initialization or encoder flush operation. |
| public void | |
| public void | |
| public void | |
| public void | |
| public abstract void | |
| public boolean | Returns: true if matches are valid, false if match finder is brokenreturn value from matches)getMatchesVerifies that the matches returned by the match finder are valid. |
| buf | back to summary |
|---|---|
| pack-priv final byte[] buf | |
| bufSize | back to summary |
|---|---|
| pack-priv final int bufSize | |
| finishing | back to summary |
|---|---|
| private boolean finishing | |
| keepSizeAfter | back to summary |
|---|---|
| private final int keepSizeAfter Number of bytes that must be available, the current byte included, to make hasEnoughData return true. Flushing and finishing are naturally exceptions to this since there cannot be any data after the end of the uncompressed input. | |
| keepSizeBefore | back to summary |
|---|---|
| private final int keepSizeBefore Number of bytes to keep available before the current byte when moving the LZ window. | |
| matchLenMax | back to summary |
|---|---|
| pack-priv final int matchLenMax | |
| MF_BT4 | back to summary |
|---|---|
| public static final int MF_BT4 | |
| MF_HC4 | back to summary |
|---|---|
| public static final int MF_HC4 | |
| niceLen | back to summary |
|---|---|
| pack-priv final int niceLen | |
| pendingSize | back to summary |
|---|---|
| private int pendingSize | |
| readLimit | back to summary |
|---|---|
| private int readLimit | |
| readPos | back to summary |
|---|---|
| pack-priv int readPos | |
| writePos | back to summary |
|---|---|
| private int writePos | |
| LZEncoder | back to summary |
|---|---|
| pack-priv LZEncoder(int dictSize, int extraSizeBefore, int extraSizeAfter, int niceLen, int matchLenMax, ArrayCache arrayCache) Creates a new LZEncoder. See | |
| copyUncompressed | back to summary |
|---|---|
| public void copyUncompressed(OutputStream out, int backward, int len) throws IOException | |
| fillWindow | back to summary |
|---|---|
| public int fillWindow(byte[] in, int off, int len) Copies new data into the LZEncoder's buffer. | |
| getAvail | back to summary |
|---|---|
| public int getAvail() Get the number of bytes available, including the current byte.
Note that the result is undefined if | |
| getBufSize | back to summary |
|---|---|
| private static int getBufSize(int dictSize, int extraSizeBefore, int extraSizeAfter, int matchLenMax) Gets the size of the LZ window buffer that needs to be allocated. | |
| getByte | back to summary |
|---|---|
| public int getByte(int backward) Gets the byte from the given backward offset.
The current byte is at
This function is equivalent to | |
| getByte | back to summary |
|---|---|
| public int getByte(int forward, int backward) Gets the byte from the given forward minus backward offset. The forward offset is added to the current position. This lets one read bytes ahead of the current byte. | |
| getInstance | back to summary |
|---|---|
| public static LZEncoder getInstance(int dictSize, int extraSizeBefore, int extraSizeAfter, int niceLen, int matchLenMax, int mf, int depthLimit, ArrayCache arrayCache) Creates a new LZEncoder.
| |
| getMatches | back to summary |
|---|---|
| public abstract Matches getMatches() Runs match finder for the next byte and returns the matches found. | |
| getMatchLen | back to summary |
|---|---|
| public int getMatchLen(int dist, int lenLimit) Get the length of a match at the given distance.
| |
| getMatchLen | back to summary |
|---|---|
| public int getMatchLen(int forward, int dist, int lenLimit) Get the length of a match at the given distance and forward offset.
| |
| getMemoryUsage | back to summary |
|---|---|
| public static int getMemoryUsage(int dictSize, int extraSizeBefore, int extraSizeAfter, int matchLenMax, int mf) Gets approximate memory usage of the LZEncoder base structure and the match finder as kibibytes. | |
| getPos | back to summary |
|---|---|
| public int getPos() Gets the lowest four bits of the absolute offset of the current byte. Bits other than the lowest four are undefined. | |
| hasEnoughData | back to summary |
|---|---|
| public boolean hasEnoughData(int alreadyReadLen) Tests if there is enough input available to let the caller encode at least one more byte. | |
| isStarted | back to summary |
|---|---|
| public boolean isStarted() Returns true if at least one byte has already been run through the match finder. | |
| movePos | back to summary |
|---|---|
| pack-priv int movePos(int requiredForFlushing, int requiredForFinishing) Moves to the next byte, checks if there is enough input available, and returns the amount of input available.
| |
| moveWindow | back to summary |
|---|---|
| private void moveWindow() Moves data from the end of the buffer to the beginning, discarding old data and making space for new input. | |
| normalize | back to summary |
|---|---|
| pack-priv static void normalize(int[] positions, int positionsCount, int normalizationOffset) | |
| processPendingBytes | back to summary |
|---|---|
| private void processPendingBytes() Process pending bytes remaining from preset dictionary initialization or encoder flush operation. | |
| putArraysToCache | back to summary |
|---|---|
| public void putArraysToCache(ArrayCache arrayCache) | |
| setFinishing | back to summary |
|---|---|
| public void setFinishing() Marks that there is no more input remaining. The read position can be advanced until the end of the data. | |
| setFlushing | back to summary |
|---|---|
| public void setFlushing() Marks that all the input needs to be made available in the encoded output. | |
| setPresetDict | back to summary |
|---|---|
| public void setPresetDict(int dictSize, byte[] presetDict) Sets a preset dictionary. If a preset dictionary is wanted, this function must be called immediately after creating the LZEncoder before any data has been encoded. | |
| skip | back to summary |
|---|---|
| public abstract void skip(int len) Skips the given number of bytes in the match finder. | |
| verifyMatches | back to summary |
|---|---|
| public boolean verifyMatches(Matches matches) Verifies that the matches returned by the match finder are valid. This is meant to be used in an assert statement. This is totally useless for actual encoding since match finder's results should naturally always be valid if it isn't broken.
| |