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-21, BSD License, Christian Gruen
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Offset for compressing texts (see DiskData).
  • Method Summary

    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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