Package io.github.mahmoudimus.zstd
Class ZstdDictionary
java.lang.Object
io.github.mahmoudimus.zstd.ZstdDictionary
A dictionary for frames compressed with one (RFC 8878 section 5): either a formatted dictionary,
as made by
zstd --train, with its own ID, entropy tables and starting offsets, or raw
content with ID 0.-
Method Summary
Modifier and TypeMethodDescriptionintReturns the size of the content frames can copy from.longid()Returns the dictionary ID frames refer to it by.static ZstdDictionaryof(byte[] data) Parsesdata: a formatted dictionary if it starts with the dictionary magic, else raw content.static ZstdDictionaryraw(byte[] content) Treats all ofcontentas a raw-content dictionary (ID 0).
-
Method Details
-
of
Parsesdata: a formatted dictionary if it starts with the dictionary magic, else raw content.- Parameters:
data- encoded dictionary or raw dictionary content- Returns:
- a dictionary containing a copy of the content
- Throws:
ZstdException- if a formatted dictionary is malformed
-
raw
Treats all ofcontentas a raw-content dictionary (ID 0).- Parameters:
content- bytes available as history before a frame's first output byte- Returns:
- a dictionary containing a copy of the supplied content
-
id
public long id()Returns the dictionary ID frames refer to it by.- Returns:
- the unsigned 32-bit dictionary ID, or 0 for raw content
-
contentSize
public int contentSize()Returns the size of the content frames can copy from.- Returns:
- the dictionary content size in bytes
-