Package org.basex.util
Class Compress
- java.lang.Object
-
- org.basex.util.Compress
-
public final class Compress extends Object
This class compresses and decompresses tokens. It is inspired by the Huffman coding, but was simplified to speed up processing.- Author:
- BaseX Team 2005-23, BSD License, Christian Gruen
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
compressed(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 Detail
-
COMPRESS
public static final long COMPRESS
Offset for compressing texts (seeDiskData
).- See Also:
- Constant Field Values
-
-
Method Detail
-
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
-
-