Package jade.imtp.leap.JICP
Class JICPCompressor1
- java.lang.Object
-
- jade.imtp.leap.JICP.JICPCompressor1
-
public class JICPCompressor1 extends Object
-
-
Constructor Summary
Constructors Constructor Description JICPCompressor1()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.static byte[]decompress(byte[] cba)decompress() algorithm: during decompression, the wordIndexes[] array will be built.
-
-
-
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) and the index of the word in the wordIndexes[] array is stored as a byte. the magic byte is encoded as (WORD_MAGIC, 255). this limits the number of words that are possible inside the wordIndexes[] 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) is detected, it will be decoded to a "real" WORD_MAGIC if the following byte is 255 (WORD_MAGIC, 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()).
-
-