Class HDTDictionarySectionPFC


  • class HDTDictionarySectionPFC
    extends HDTDictionarySection
    HDT DictionarySection Plain Front Coding.

    This part starts with a byte indicating the type of the dictionary section, followed by the VByte-encoded number of strings, the VByte-encoded buffer size and the VByte-encoded buffer length.

    Then the 8-bit CRC.

    Followed by an array and one or more buffers, and the 32-bit CRC calculated over the index and the buffers.

    Structure:

     +------+--------------+--------------+-------+------+-------+--------+...+-------+
     | type | totalStrings | stringsBlock | array | CRC8 | index | buffer |...| CRC32 |
     +------+--------------+--------------+-------+------+-------+--------+...+-------+
     

    Each buffer starts with a full string, followed by a maximum of stringsBlock - 1 pair of a VByte-encoded number of characters this string has in common with the _previous_ string, and the (different) suffix.

    E.g. abcdef 2 gh 3 ij will result in abcde, abgh, abgij.

    Buffer structure:

     +--------+--------+--------+...+--------+--------+
     | string | common | suffix |...| common | suffix |
     +--------+--------+--------+...+--------+--------+
     
    • Field Detail

      • buffer

        private byte[] buffer
      • totalStrings

        private int totalStrings
      • stringsBlock

        private int stringsBlock
      • blockStarts

        private HDTArray blockStarts
      • cache

        private final java.util.LinkedHashMap<java.lang.Integer,​java.util.ArrayList<byte[]>> cache
    • Constructor Detail

      • HDTDictionarySectionPFC

        protected HDTDictionarySectionPFC​(java.lang.String name,
                                          long pos)
        Constructor
        Parameters:
        name -
        pos -
    • Method Detail

      • get

        protected byte[] get​(int i)
                      throws java.io.IOException
        Description copied from class: HDTDictionarySection
        Get the entry
        Specified by:
        get in class HDTDictionarySection
        Parameters:
        i - zero-based index
        Returns:
        Throws:
        java.io.IOException
      • parse

        protected void parse​(java.io.InputStream is)
                      throws java.io.IOException
        Description copied from class: HDTPart
        Parse from input stream
        Specified by:
        parse in class HDTPart
        Throws:
        java.io.IOException
      • decodeBlock

        private java.util.ArrayList<byte[]> decodeBlock​(int block,
                                                        int start)
                                                 throws java.io.IOException
        Parse a single block
        Parameters:
        block - block number
        start - starting position
        Returns:
        list of decoded byte strings
        Throws:
        java.io.IOException