Le 18/12/2013 09:21, Stefan Bodewig a écrit : > The end-of-information part could probably be dealt with in the subclass > specific implementation of decompressNextSymbol and increasing the code > size may happen in addEntry, not sure. As for endianess, Emmanuel > briefly mentioned a BitInputStream he had for the IMPLODE algortihm on > IRC, maybe this could be used inside readNextCode and hide the concrete > endianess?
I wrote two support classes to implement the explode algorithm: - BitStream: takes an InputStream and returns the bits one by one with a readBit() method, or n bits with readBits(n) (up to 8 bits). It doesn't implement InputStream. The bit stream is formed by reading the bytes one by one from the InputStream, and appending its bits to the left of a long used as a buffer. There is no notion of endianness. - BinaryTree: decodes the symbols on calling read(BitStream) I suspect this could be reused for a huffman encoded input stream but I haven't checked the details yet. Emmanuel --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org