final class LZ4
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
LZ4.HashTable |
(package private) static class |
LZ4.HCHashTable |
private static class |
LZ4.Match |
Modifier and Type | Field and Description |
---|---|
(package private) static int |
HASH_LOG_HC |
(package private) static int |
HASH_TABLE_SIZE_HC |
(package private) static int |
LAST_LITERALS |
(package private) static int |
MAX_DISTANCE |
(package private) static int |
MEMORY_USAGE |
(package private) static int |
MIN_MATCH |
(package private) static int |
OPTIMAL_ML |
Modifier | Constructor and Description |
---|---|
private |
LZ4() |
Modifier and Type | Method and Description |
---|---|
private static int |
commonBytes(byte[] b,
int o1,
int o2,
int limit) |
private static int |
commonBytesBackward(byte[] b,
int o1,
int o2,
int l1,
int l2) |
static void |
compress(byte[] bytes,
int off,
int len,
DataOutput out,
LZ4.HashTable ht)
Compress
bytes[off:off+len] into out using
at most 16KB of memory. |
static void |
compressHC(byte[] src,
int srcOff,
int srcLen,
DataOutput out,
LZ4.HCHashTable ht)
Compress
bytes[off:off+len] into out . |
private static void |
copyTo(LZ4.Match m1,
LZ4.Match m2) |
static int |
decompress(DataInput compressed,
int decompressedLen,
byte[] dest,
int dOff)
Decompress at least
decompressedLen bytes into
dest[dOff:] . |
private static void |
encodeLastLiterals(byte[] bytes,
int anchor,
int literalLen,
DataOutput out) |
private static void |
encodeLen(int l,
DataOutput out) |
private static void |
encodeLiterals(byte[] bytes,
int token,
int anchor,
int literalLen,
DataOutput out) |
private static void |
encodeSequence(byte[] bytes,
int anchor,
int matchRef,
int matchOff,
int matchLen,
DataOutput out) |
private static int |
hash(int i,
int hashBits) |
private static int |
hashHC(int i) |
private static int |
readInt(byte[] buf,
int i) |
private static boolean |
readIntEquals(byte[] buf,
int i,
int j) |
static final int MEMORY_USAGE
static final int MIN_MATCH
static final int MAX_DISTANCE
static final int LAST_LITERALS
static final int HASH_LOG_HC
static final int HASH_TABLE_SIZE_HC
static final int OPTIMAL_ML
private static int hash(int i, int hashBits)
private static int hashHC(int i)
private static int readInt(byte[] buf, int i)
private static boolean readIntEquals(byte[] buf, int i, int j)
private static int commonBytes(byte[] b, int o1, int o2, int limit)
private static int commonBytesBackward(byte[] b, int o1, int o2, int l1, int l2)
public static int decompress(DataInput compressed, int decompressedLen, byte[] dest, int dOff) throws java.io.IOException
decompressedLen
bytes into
dest[dOff:]
. Please note that dest
must be large
enough to be able to hold all decompressed data (meaning that you
need to know the total decompressed length).java.io.IOException
private static void encodeLen(int l, DataOutput out) throws java.io.IOException
java.io.IOException
private static void encodeLiterals(byte[] bytes, int token, int anchor, int literalLen, DataOutput out) throws java.io.IOException
java.io.IOException
private static void encodeLastLiterals(byte[] bytes, int anchor, int literalLen, DataOutput out) throws java.io.IOException
java.io.IOException
private static void encodeSequence(byte[] bytes, int anchor, int matchRef, int matchOff, int matchLen, DataOutput out) throws java.io.IOException
java.io.IOException
public static void compress(byte[] bytes, int off, int len, DataOutput out, LZ4.HashTable ht) throws java.io.IOException
bytes[off:off+len]
into out
using
at most 16KB of memory. ht
shouldn't be shared across threads
but can safely be reused.java.io.IOException
public static void compressHC(byte[] src, int srcOff, int srcLen, DataOutput out, LZ4.HCHashTable ht) throws java.io.IOException
bytes[off:off+len]
into out
. Compared to
compress(byte[], int, int, DataOutput, HashTable)
, this method
is slower and uses more memory (~ 256KB per thread) but should provide
better compression ratios (especially on large inputs) because it chooses
the best match among up to 256 candidates and then performs trade-offs to
fix overlapping matches. ht
shouldn't be shared across threads
but can safely be reused.java.io.IOException