public class Zstd
extends java.lang.Object
Constructor and Description |
---|
Zstd() |
Modifier and Type | Method and Description |
---|---|
static int |
blockSizeMax() |
static int |
chainLogMax() |
static int |
chainLogMin() |
static byte[] |
compress(byte[] src)
Compresses the data in buffer 'src' using defaul compression level
|
static long |
compress(byte[] dst,
byte[] src,
byte[] dict,
int level)
Compresses buffer 'src' into buffer 'dst' with dictionary.
|
static long |
compress(byte[] dst,
byte[] src,
int level)
Compresses buffer 'src' into buffer 'dst'.
|
static byte[] |
compress(byte[] src,
int level)
Compresses the data in buffer 'src'
|
static byte[] |
compress(byte[] src,
ZstdDictCompress dict)
Compresses the data in buffer 'src'
|
static java.nio.ByteBuffer |
compress(java.nio.ByteBuffer srcBuff,
byte[] dict,
int level)
Compresses buffer 'src' into buffer 'dst' with dictionary.
|
static int |
compress(java.nio.ByteBuffer dstBuff,
java.nio.ByteBuffer srcBuff,
byte[] dict,
int level)
Compresses buffer 'src' into buffer 'dst' with dictionary.
|
static int |
compress(java.nio.ByteBuffer dstBuf,
java.nio.ByteBuffer srcBuf,
int level)
Compresses the data in buffer 'srcBuf'
|
static int |
compress(java.nio.ByteBuffer dstBuff,
java.nio.ByteBuffer srcBuff,
ZstdDictCompress dict)
Compresses buffer 'src' into buffer 'dst' with dictionary.
|
static java.nio.ByteBuffer |
compress(java.nio.ByteBuffer srcBuf,
int level)
Compresses the data in buffer 'srcBuf'
|
static java.nio.ByteBuffer |
compress(java.nio.ByteBuffer srcBuff,
ZstdDictCompress dict)
Compresses buffer 'src' into buffer 'dst' with dictionary.
|
static long |
compressBound(long srcSize)
Maximum size of the compressed data
|
static long |
compressDirectByteBuffer(java.nio.ByteBuffer dst,
int dstOffset,
int dstSize,
java.nio.ByteBuffer src,
int srcOffset,
int srcSize,
int level)
Compresses buffer 'src' into buffer 'dst'.
|
static long |
compressDirectByteBufferFastDict(java.nio.ByteBuffer dst,
int dstOffset,
int dstSize,
java.nio.ByteBuffer src,
int srcOffset,
int srcSize,
ZstdDictCompress dict)
Compresses buffer 'src' into buffer 'dst' with dictionary.
|
static long |
compressDirectByteBufferUsingDict(java.nio.ByteBuffer dst,
int dstOffset,
int dstSize,
java.nio.ByteBuffer src,
int srcOffset,
int srcSize,
byte[] dict,
int level)
Compresses direct byte buffer 'src' into direct byte buffer 'dst' with dictionary.
|
static long |
compressFastDict(byte[] dst,
int dstOffset,
byte[] src,
int srcOffset,
int length,
ZstdDictCompress dict)
Compresses buffer 'src' into buffer 'dst' with dictionary.
|
static long |
compressUsingDict(byte[] dst,
byte[] src,
byte[] dict,
int level)
Deprecated.
Use compress(dst, src, dict, level) instead
|
static byte[] |
compressUsingDict(byte[] src,
byte[] dict,
int level)
Compresses buffer 'src' with dictionary.
|
static long |
compressUsingDict(byte[] dst,
int dstOffset,
byte[] src,
int srcOffset,
int length,
byte[] dict,
int level)
Compresses buffer 'src' into buffer 'dst' with dictionary.
|
static long |
decompress(byte[] dst,
byte[] src)
Decompresses buffer 'src' into buffer 'dst'.
|
static long |
decompress(byte[] dst,
byte[] src,
byte[] dict)
Decompresses buffer 'src' into buffer 'dst' with dictionary.
|
static byte[] |
decompress(byte[] src,
byte[] dict,
int originalSize) |
static byte[] |
decompress(byte[] src,
int originalSize)
Decompress data
|
static byte[] |
decompress(byte[] src,
ZstdDictDecompress dict,
int originalSize)
Decompress data
|
static java.nio.ByteBuffer |
decompress(java.nio.ByteBuffer srcBuff,
byte[] dict,
int originalSize)
Decompress data
|
static int |
decompress(java.nio.ByteBuffer dstBuf,
java.nio.ByteBuffer srcBuf)
Decompress data
|
static int |
decompress(java.nio.ByteBuffer dstBuff,
java.nio.ByteBuffer srcBuff,
byte[] dict)
Decompress data
|
static int |
decompress(java.nio.ByteBuffer dstBuff,
java.nio.ByteBuffer srcBuff,
ZstdDictDecompress dict)
Decompress data
|
static java.nio.ByteBuffer |
decompress(java.nio.ByteBuffer srcBuf,
int originalSize)
Decompress data
|
static java.nio.ByteBuffer |
decompress(java.nio.ByteBuffer srcBuff,
ZstdDictDecompress dict,
int originalSize)
Decompress data
|
static long |
decompressDirectByteBuffer(java.nio.ByteBuffer dst,
int dstOffset,
int dstSize,
java.nio.ByteBuffer src,
int srcOffset,
int srcSize)
Decompresses buffer 'src' into buffer 'dst'.
|
static long |
decompressDirectByteBufferFastDict(java.nio.ByteBuffer dst,
int dstOffset,
int dstSize,
java.nio.ByteBuffer src,
int srcOffset,
int srcSize,
ZstdDictDecompress dict)
Decompresses buffer 'src' into buffer 'dst' with dictionary.
|
static long |
decompressDirectByteBufferUsingDict(java.nio.ByteBuffer dst,
int dstOffset,
int dstSize,
java.nio.ByteBuffer src,
int srcOffset,
int srcSize,
byte[] dict)
Decompresses buffer 'src' into buffer 'dst' with dictionary.
|
static long |
decompressedDirectByteBufferSize(java.nio.ByteBuffer src,
int srcPosition,
int srcSize)
Return the original size of a compressed buffer (if known)
|
static long |
decompressedSize(byte[] src)
Return the original size of a compressed buffer (if known)
|
static long |
decompressedSize(java.nio.ByteBuffer srcBuf)
Return the original size of a compressed buffer (if known)
|
static long |
decompressFastDict(byte[] dst,
int dstOffset,
byte[] src,
int srcOffset,
int length,
ZstdDictDecompress dict)
Decompresses buffer 'src' into buffer 'dst' with dictionary.
|
static long |
decompressUsingDict(byte[] dst,
byte[] src,
byte[] dict)
Deprecated.
Use decompress(dst, src, dict) instead
|
static long |
decompressUsingDict(byte[] dst,
int dstOffset,
byte[] src,
int srcOffset,
int length,
byte[] dict)
Decompresses buffer 'src' into buffer 'dst' with dictionary.
|
static int |
frameHeaderSizeMax() |
static int |
frameHeaderSizeMin() |
static java.lang.String |
getErrorName(long code) |
static int |
hashLogMax() |
static int |
hashLogMin() |
static boolean |
isError(long code)
Error handling
|
static int |
magicNumber() |
static int |
searchLengthMax() |
static int |
searchLengthMin() |
static int |
searchLogMax() |
static int |
searchLogMin() |
static int |
targetLengthMax() |
static int |
targetLengthMin() |
static long |
trainFromBuffer(byte[][] samples,
byte[] dictBuffer)
Creates a new dictionary to tune a kind of samples
|
static int |
windowLogMax() |
static int |
windowLogMin() |
public static long compress(byte[] dst, byte[] src, int level)
dst
- the destination buffersrc
- the source bufferlevel
- compression levelpublic static long compressDirectByteBuffer(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, int level)
dst
- the destination buffersrc
- the source bufferlevel
- compression levelpublic static long compressUsingDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, int length, byte[] dict, int level)
dst
- the destination bufferdstOffset
- the start offset of 'dst'src
- the source buffersrcOffset
- the start offset of 'src'length
- the length of 'src'dict
- the dictionary bufferlevel
- compression levelpublic static long compressDirectByteBufferUsingDict(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, byte[] dict, int level)
dst
- the destination bufferdstOffset
- the start offset of 'dst'dstSize
- size of 'dst'src
- the source buffersrcOffset
- the start offset of 'src'srcSize
- the length of 'src'dict
- the dictionary bufferlevel
- compression levelpublic static long compressFastDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, int length, ZstdDictCompress dict)
dst
- the destination bufferdstOffset
- the start offset of 'dst'src
- the source buffersrcOffset
- the start offset of 'src'length
- the length of 'src'dict
- the dictionarypublic static long compressDirectByteBufferFastDict(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, ZstdDictCompress dict)
dst
- the destination bufferdstOffset
- the start offset of 'dst'dstSize
- the size of 'dst'src
- the source buffersrcOffset
- the start offset of 'src'srcSize
- the length of 'src'dict
- the dictionarypublic static long decompress(byte[] dst, byte[] src)
dst
- the destination buffersrc
- the source bufferpublic static long decompressDirectByteBuffer(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize)
dst
- the destination buffersrc
- the source bufferpublic static long decompressUsingDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, int length, byte[] dict)
dst
- the destination bufferdstOffset
- the start offset of 'dst'src
- the source buffersrcOffset
- the start offset of 'src'length
- the length of 'src'dict
- the dictionary bufferpublic static long decompressDirectByteBufferUsingDict(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, byte[] dict)
dst
- the destination bufferdstOffset
- the start offset of 'dst'dstSize
- size of 'dst'src
- the source buffersrcOffset
- the start offset of 'src'srcSize
- the size of 'src'dict
- the dictionary bufferpublic static long decompressFastDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, int length, ZstdDictDecompress dict)
dst
- the destination bufferdstOffset
- the start offset of 'dst'src
- the source buffersrcOffset
- the start offset of 'src'length
- the length of 'src'dict
- the dictionarypublic static long decompressDirectByteBufferFastDict(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, ZstdDictDecompress dict)
dst
- the destination bufferdstOffset
- the start offset of 'dst'dstSize
- the size of 'dst'src
- the source buffersrcOffset
- the start offset of 'src'srcSize
- the size of 'src'dict
- the dictionarypublic static long decompressedSize(byte[] src)
src
- the compressed bufferpublic static long decompressedDirectByteBufferSize(java.nio.ByteBuffer src, int srcPosition, int srcSize)
src
- the compressed bufferpublic static long compressBound(long srcSize)
srcSize
- the size of the data to be compressedpublic static boolean isError(long code)
code
- return code/sizepublic static java.lang.String getErrorName(long code)
public static long trainFromBuffer(byte[][] samples, byte[] dictBuffer)
samples
- the samples buffer arraydictBuffer
- the new dictionary bufferpublic static int magicNumber()
public static int windowLogMin()
public static int windowLogMax()
public static int chainLogMin()
public static int chainLogMax()
public static int hashLogMin()
public static int hashLogMax()
public static int searchLogMin()
public static int searchLogMax()
public static int searchLengthMin()
public static int searchLengthMax()
public static int targetLengthMin()
public static int targetLengthMax()
public static int frameHeaderSizeMin()
public static int frameHeaderSizeMax()
public static int blockSizeMax()
public static byte[] compress(byte[] src)
src
- the source bufferpublic static byte[] compress(byte[] src, int level)
src
- the source bufferlevel
- compression levelpublic static int compress(java.nio.ByteBuffer dstBuf, java.nio.ByteBuffer srcBuf, int level)
dstBuf
- the destination buffer. must be direct. It is assumed that the position() of this buffer marks the offset
at which the compressed data are to be written, and that the limit() of this buffer is the maximum
compressed data size to allow.
When this method returns successfully, dstBuf's position() will be set to its current position() plus the compressed size of the data.
srcBuf
- the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the
uncompressed data to be compressed, and that the limit() of this buffer marks its end.
When this method returns successfully, srcBuf's position() will be set to its limit().
level
- compression levelpublic static java.nio.ByteBuffer compress(java.nio.ByteBuffer srcBuf, int level)
srcBuf
- the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the
uncompressed data to be compressed, and that the limit() of this buffer marks its end.
When this method returns successfully, srcBuf's position() will be set to its limit().
level
- compression levelpublic static byte[] compress(byte[] src, ZstdDictCompress dict)
src
- the source bufferdict
- dictionary to use@Deprecated public static long compressUsingDict(byte[] dst, byte[] src, byte[] dict, int level)
public static byte[] compressUsingDict(byte[] src, byte[] dict, int level)
src
- the source bufferdict
- the dictionary bufferlevel
- compression levelpublic static long compress(byte[] dst, byte[] src, byte[] dict, int level)
dst
- the destination buffersrc
- the source bufferdict
- the dictionary bufferlevel
- compression levelpublic static int compress(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, byte[] dict, int level)
dstBuff
- the destination buffersrcBuff
- the source bufferdict
- the dictionary bufferlevel
- compression levelpublic static java.nio.ByteBuffer compress(java.nio.ByteBuffer srcBuff, byte[] dict, int level)
srcBuff
- the source bufferdict
- the dictionary bufferlevel
- compression levelpublic static int compress(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, ZstdDictCompress dict)
dstBuff
- the destination buffersrcBuff
- the source bufferdict
- the dictionary bufferpublic static java.nio.ByteBuffer compress(java.nio.ByteBuffer srcBuff, ZstdDictCompress dict)
srcBuff
- the source bufferdict
- the dictionary bufferpublic static byte[] decompress(byte[] src, int originalSize)
src
- the source bufferoriginalSize
- the maximum size of the uncompressed datapublic static int decompress(java.nio.ByteBuffer dstBuf, java.nio.ByteBuffer srcBuf)
dstBuf
- the destination buffer. must be direct. It is assumed that the position() of this buffer marks the offset
at which the decompressed data are to be written, and that the limit() of this buffer is the maximum
decompressed data size to allow.
When this method returns successfully, dstBuf's position() will be set to its current position() plus the decompressed size of the data.
srcBuf
- the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the
compressed data to be decompressed, and that the limit() of this buffer marks its end.
When this method returns successfully, srcBuf's position() will be set to its limit().
public static java.nio.ByteBuffer decompress(java.nio.ByteBuffer srcBuf, int originalSize)
srcBuf
- the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the
compressed data to be decompressed, and that the limit() of this buffer marks its end.
When this method returns successfully, srcBuf's position() will be set to its limit().
originalSize
- the maximum size of the uncompressed datapublic static byte[] decompress(byte[] src, ZstdDictDecompress dict, int originalSize)
src
- the source bufferdict
- dictionary to useoriginalSize
- the maximum size of the uncompressed data@Deprecated public static long decompressUsingDict(byte[] dst, byte[] src, byte[] dict)
public static long decompress(byte[] dst, byte[] src, byte[] dict)
dst
- the destination buffersrc
- the source bufferdict
- the dictionary bufferpublic static byte[] decompress(byte[] src, byte[] dict, int originalSize)
src
- the source bufferdict
- dictionary to useoriginalSize
- the maximum size of the uncompressed datapublic static long decompressedSize(java.nio.ByteBuffer srcBuf)
srcBuf
- the compressed buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the
compressed data whose decompressed size is being queried, and that the limit() of this buffer marks its
end.public static int decompress(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, byte[] dict)
dstBuff
- the destination buffer. must be direct. It is assumed that the position() of this buffer marks the offset
at which the decompressed data are to be written, and that the limit() of this buffer is the maximum
decompressed data size to allow.
When this method returns successfully, dstBuff's position() will be set to its current position() plus the decompressed size of the data.
srcBuff
- the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the
compressed data to be decompressed, and that the limit() of this buffer marks its end.
When this method returns successfully, srcBuff's position() will be set to its limit().
dict
- the dictionary buffer to use for compressionpublic static java.nio.ByteBuffer decompress(java.nio.ByteBuffer srcBuff, byte[] dict, int originalSize)
srcBuff
- the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the
compressed data to be decompressed, and that the limit() of this buffer marks its end.
When this method returns successfully, srcBuff's position() will be set to its limit().
dict
- the dictionary used in the compressionoriginalSize
- the maximum size of the uncompressed datapublic static int decompress(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, ZstdDictDecompress dict)
dstBuff
- the destination buffer. must be direct. It is assumed that the position() of this buffer marks the offset
at which the decompressed data are to be written, and that the limit() of this buffer is the maximum
decompressed data size to allow.
When this method returns successfully, dstBuff's position() will be set to its current position() plus the decompressed size of the data.
srcBuff
- the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the
compressed data to be decompressed, and that the limit() of this buffer marks its end.
When this method returns successfully, srcBuff's position() will be set to its limit().
dict
- the dictionary buffer to use for compressionpublic static java.nio.ByteBuffer decompress(java.nio.ByteBuffer srcBuff, ZstdDictDecompress dict, int originalSize)
srcBuff
- the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the
compressed data to be decompressed, and that the limit() of this buffer marks its end.
When this method returns successfully, srcBuff's position() will be set to its limit().
dict
- the dictionary used in the compressionoriginalSize
- the maximum size of the uncompressed data