Package org.basex.util
Class Compress
java.lang.Object
org.basex.util.Compress
This class compresses and decompresses tokens. It is inspired by the
Huffman coding, but was simplified to speed up processing.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancompressed(long value) Indicates if the specified value is inlined.static byte[]pack(byte[] text) Compresses the specified text.static byte[]unpack(byte[] text) Decompresses the specified text.
-
Field Details
-
COMPRESS
public static final long COMPRESSOffset for compressing texts (seeDiskData).- See Also:
-
-
Method Details
-
pack
public static byte[] pack(byte[] text) Compresses the specified text. Returns the original text if the packed text is not shorter.- Parameters:
text- text to be packed- Returns:
- packed or original text
-
unpack
public static byte[] unpack(byte[] text) Decompresses the specified text.- Parameters:
text- compressed text- Returns:
- unpacked text
-
compressed
public static boolean compressed(long value) Indicates if the specified value is inlined.- Parameters:
value- value- Returns:
- result of check
-