public static void decompress(ByteArray input, ByteArray output) throws FormatException { decompress(input, 0, output); }
private static void decompress(ByteArray input, int index, ByteArray output) throws FormatException { // The data is compressed on a bit basis, so use a bit index. int[] bitIndex = new int[1]; bitIndex[0] = index * 8; // Process all blocks one by one until the end. // inflateBlock() returns false if no more block exists. while (inflateBlock(input, bitIndex, output)) {} }
private static void inflateDynamicBlock( ByteArray input, int[] bitIndex, ByteArray output) throws FormatException { // 3.2.7 Compression with dynamic Huffman codes (BTYPE=10) // Read 2 tables. One is a table to convert "code value of literal/length // alphabet" into "literal/length symbol". The other is a table to convert // "code value of distance alphabet" into "distance symbol". Huffman[] tables = new Huffman[2]; DeflateUtil.readDynamicTables(input, bitIndex, tables); // The actual compressed data of this block. The data are encoded using // the literal/length and distance Huffman codes that were parsed above. inflateData(input, bitIndex, output, tables[0], tables[1]); }
inflatePlainBlock(input, bitIndex, output); break; inflateFixedBlock(input, bitIndex, output); break; inflateDynamicBlock(input, bitIndex, output); break;
duplicate(length, distance, output);
inflatePlainBlock(input, bitIndex, output); break; inflateFixedBlock(input, bitIndex, output); break; inflateDynamicBlock(input, bitIndex, output); break;
duplicate(length, distance, output);
DeflateDecompressor.decompress(input, mIncomingSlidingWindow);
private static void inflateFixedBlock( ByteArray input, int[] bitIndex, ByteArray output) throws FormatException { // 3.2.6 Compression with fixed Huffman codes (BTYPE=01) // Inflate the compressed data using the pre-defined // conversion tables. The specification says in 3.2.2 // as follows. // // The only differences between the two compressed // cases is how the Huffman codes for the literal/ // length and distance alphabets are defined. // // The "two compressed cases" in the above sentence are // "fixed Huffman codes" and "dynamic Huffman codes". inflateData(input, bitIndex, output, FixedLiteralLengthHuffman.getInstance(), FixedDistanceHuffman.getInstance()); }
private static void decompress(ByteArray input, int index, ByteArray output) throws FormatException { // The data is compressed on a bit basis, so use a bit index. int[] bitIndex = new int[1]; bitIndex[0] = index * 8; // Process all blocks one by one until the end. // inflateBlock() returns false if no more block exists. while (inflateBlock(input, bitIndex, output)) {} }
public static void decompress(ByteArray input, ByteArray output) throws FormatException { decompress(input, 0, output); }
private static void inflateDynamicBlock( ByteArray input, int[] bitIndex, ByteArray output) throws FormatException { // 3.2.7 Compression with dynamic Huffman codes (BTYPE=10) // Read 2 tables. One is a table to convert "code value of literal/length // alphabet" into "literal/length symbol". The other is a table to convert // "code value of distance alphabet" into "distance symbol". Huffman[] tables = new Huffman[2]; DeflateUtil.readDynamicTables(input, bitIndex, tables); // The actual compressed data of this block. The data are encoded using // the literal/length and distance Huffman codes that were parsed above. inflateData(input, bitIndex, output, tables[0], tables[1]); }
DeflateDecompressor.decompress(input, mIncomingSlidingWindow);
private static void inflateFixedBlock( ByteArray input, int[] bitIndex, ByteArray output) throws FormatException { // 3.2.6 Compression with fixed Huffman codes (BTYPE=01) // Inflate the compressed data using the pre-defined // conversion tables. The specification says in 3.2.2 // as follows. // // The only differences between the two compressed // cases is how the Huffman codes for the literal/ // length and distance alphabets are defined. // // The "two compressed cases" in the above sentence are // "fixed Huffman codes" and "dynamic Huffman codes". inflateData(input, bitIndex, output, FixedLiteralLengthHuffman.getInstance(), FixedDistanceHuffman.getInstance()); }