Class JICPCompressor


  • public class JICPCompressor
    extends Object
    • Constructor Detail

      • JICPCompressor

        public JICPCompressor()
    • Method Detail

      • compress

        public static byte[] compress​(byte[] ba)
        compress() algorithm: if during compression a word is detected, its position inside the array is stored in the wordIndexes[] array. but only, if the word itself was not found in the array before. if so, only a magic byte (WORD_MAGIC=255) and the index of the word in the wordIndexes[] array is stored as a byte. the magic byte is encoded as (255, 255). this limits the number of words that are possible inside the wordIndexs[] array to 254 (=MAX_WORD constant).
      • decompress

        public static byte[] decompress​(byte[] cba)
        decompress() algorithm: during decompression, the wordIndexes[] array will be built. this is done by reading the compressed array, decode it and look for words. if a magic byte (WORD_MAGIC=255) is detected, it will be decoded to a "real" 255 if the following byte is also 255 (255, 255 - sequence). if the following byte is not 255, it is treated as an index in the wordIndexes[] array. the index stored inside there is used as the beginning of a word. this word will be copied to the end of the decoded stream. the end of the word is detected by a separator (see isSep()).