Examples of HuffmanDecoder


Examples of org.toubassi.femtozip.coding.huffman.HuffmanDecoder

    }
   
    public byte[] decompress(byte[] compressedData) {
        try {
            ByteArrayInputStream bytesIn = new ByteArrayInputStream(compressedData);
            HuffmanDecoder decoder = new HuffmanDecoder(codeModel, bytesIn);
            ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(compressedData.length * 2);
           
            int nextSymbol;
            while ((nextSymbol = decoder.decodeSymbol()) != -1) {
                bytesOut.write((byte)nextSymbol);
            }
            return bytesOut.toByteArray();
        }
        catch (IOException e) {
View Full Code Here

Examples of org.toubassi.femtozip.coding.huffman.HuffmanDecoder

    }
   
    public byte[] decompress(byte[] compressedBytes) {
        try {
            ByteArrayInputStream bytesIn = new ByteArrayInputStream(compressedBytes);
            HuffmanDecoder decoder = new HuffmanDecoder(codeModel.createModel(), bytesIn);
            SubstringUnpacker unpacker = new SubstringUnpacker(dictionary);
       
            int nextSymbol;
            while ((nextSymbol = decoder.decodeSymbol()) != -1) {
                if (nextSymbol > 255) {
                    int length = nextSymbol - 256;
                    int offset = decoder.decodeSymbol() | (decoder.decodeSymbol() << 4) | (decoder.decodeSymbol() << 8) | (decoder.decodeSymbol() << 12);
                    offset = -offset;
                    unpacker.encodeSubstring(offset, length, null);
                }
                else {
                    unpacker.encodeLiteral(nextSymbol, null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.