static PngHuffmanTables getDynamicTables(PngDecodingDataStream stream) throws IOException { return new PngHuffmanTables(stream); } static PngHuffmanTables getFixedTables() {
private PngHuffmanTables () { literalTable = getFixedLiteralTable(); distanceTable = getFixedDistanceTable(); }
void readNextBlockHeader() throws IOException { isLastBlock = stream.getNextIdatBit() != 0; compressionType = (byte) stream.getNextIdatBits(2); if (compressionType > 2) stream.error(); if (compressionType == UNCOMPRESSED) { byte b1 = stream.getNextIdatByte(); byte b2 = stream.getNextIdatByte(); byte b3 = stream.getNextIdatByte(); byte b4 = stream.getNextIdatByte(); if (b1 != ~b3 || b2 != ~b4) stream.error(); uncompressedBytesRemaining = (b1 & 0xFF) | ((b2 & 0xFF) << 8); } else if (compressionType == COMPRESSED_DYNAMIC) { huffmanTables = PngHuffmanTables.getDynamicTables(stream); } else { huffmanTables = PngHuffmanTables.getFixedTables(); } }
int value = huffmanTables.getNextLiteralValue(stream); if (value < END_OF_COMPRESSED_BLOCK) { window[windowIndex] = (byte) value; value = huffmanTables.getNextDistanceValue(stream); if (value > LAST_DISTANCE_CODE) stream.error(); extraBits = extraDistanceBits[value];
private void assertBlockAtEnd() throws IOException { if (compressionType == UNCOMPRESSED) { if (uncompressedBytesRemaining > 0) stream.error(); } else if (copyBytesRemaining > 0 || (huffmanTables.getNextLiteralValue(stream) != END_OF_COMPRESSED_BLOCK)) { stream.error(); } } void assertCompressedDataAtEnd() throws IOException {
int[] literalLengths = readLengths( stream, literals, codeLengthsTable, LiteralTableSize); int[] distanceLengths = readLengths( stream, distances, codeLengthsTable, DistanceTableSize);
void readNextBlockHeader() throws IOException { isLastBlock = stream.getNextIdatBit() != 0; compressionType = (byte) stream.getNextIdatBits(2); if (compressionType > 2) stream.error(); if (compressionType == UNCOMPRESSED) { byte b1 = stream.getNextIdatByte(); byte b2 = stream.getNextIdatByte(); byte b3 = stream.getNextIdatByte(); byte b4 = stream.getNextIdatByte(); if (b1 != ~b3 || b2 != ~b4) stream.error(); uncompressedBytesRemaining = (b1 & 0xFF) | ((b2 & 0xFF) << 8); } else if (compressionType == COMPRESSED_DYNAMIC) { huffmanTables = PngHuffmanTables.getDynamicTables(stream); } else { huffmanTables = PngHuffmanTables.getFixedTables(); } }
int value = huffmanTables.getNextLiteralValue(stream); if (value < END_OF_COMPRESSED_BLOCK) { window[windowIndex] = (byte) value; value = huffmanTables.getNextDistanceValue(stream); if (value > LAST_DISTANCE_CODE) stream.error(); extraBits = extraDistanceBits[value];
private void assertBlockAtEnd() throws IOException { if (compressionType == UNCOMPRESSED) { if (uncompressedBytesRemaining > 0) stream.error(); } else if (copyBytesRemaining > 0 || (huffmanTables.getNextLiteralValue(stream) != END_OF_COMPRESSED_BLOCK)) { stream.error(); } } void assertCompressedDataAtEnd() throws IOException {
int[] literalLengths = readLengths( stream, literals, codeLengthsTable, LiteralTableSize); int[] distanceLengths = readLengths( stream, distances, codeLengthsTable, DistanceTableSize);
private PngHuffmanTables () { literalTable = getFixedLiteralTable(); distanceTable = getFixedDistanceTable(); }
void readNextBlockHeader() throws IOException { isLastBlock = stream.getNextIdatBit() != 0; compressionType = (byte) stream.getNextIdatBits(2); if (compressionType > 2) stream.error(); if (compressionType == UNCOMPRESSED) { byte b1 = stream.getNextIdatByte(); byte b2 = stream.getNextIdatByte(); byte b3 = stream.getNextIdatByte(); byte b4 = stream.getNextIdatByte(); if (b1 != ~b3 || b2 != ~b4) stream.error(); uncompressedBytesRemaining = (b1 & 0xFF) | ((b2 & 0xFF) << 8); } else if (compressionType == COMPRESSED_DYNAMIC) { huffmanTables = PngHuffmanTables.getDynamicTables(stream); } else { huffmanTables = PngHuffmanTables.getFixedTables(); } }
int value = huffmanTables.getNextLiteralValue(stream); if (value < END_OF_COMPRESSED_BLOCK) { window[windowIndex] = (byte) value; value = huffmanTables.getNextDistanceValue(stream); if (value > LAST_DISTANCE_CODE) stream.error(); extraBits = extraDistanceBits[value];
static PngHuffmanTables getDynamicTables(PngDecodingDataStream stream) throws IOException { return new PngHuffmanTables(stream); } static PngHuffmanTables getFixedTables() {
private void assertBlockAtEnd() throws IOException { if (compressionType == UNCOMPRESSED) { if (uncompressedBytesRemaining > 0) stream.error(); } else if (copyBytesRemaining > 0 || (huffmanTables.getNextLiteralValue(stream) != END_OF_COMPRESSED_BLOCK)) { stream.error(); } } void assertCompressedDataAtEnd() throws IOException {
int[] literalLengths = readLengths( stream, literals, codeLengthsTable, LiteralTableSize); int[] distanceLengths = readLengths( stream, distances, codeLengthsTable, DistanceTableSize);
private PngHuffmanTables () { literalTable = getFixedLiteralTable(); distanceTable = getFixedDistanceTable(); }
void readNextBlockHeader() throws IOException { isLastBlock = stream.getNextIdatBit() != 0; compressionType = (byte) stream.getNextIdatBits(2); if (compressionType > 2) stream.error(); if (compressionType == UNCOMPRESSED) { byte b1 = stream.getNextIdatByte(); byte b2 = stream.getNextIdatByte(); byte b3 = stream.getNextIdatByte(); byte b4 = stream.getNextIdatByte(); if (b1 != ~b3 || b2 != ~b4) stream.error(); uncompressedBytesRemaining = (b1 & 0xFF) | ((b2 & 0xFF) << 8); } else if (compressionType == COMPRESSED_DYNAMIC) { huffmanTables = PngHuffmanTables.getDynamicTables(stream); } else { huffmanTables = PngHuffmanTables.getFixedTables(); } }
int value = huffmanTables.getNextLiteralValue(stream); if (value < END_OF_COMPRESSED_BLOCK) { window[windowIndex] = (byte) value; value = huffmanTables.getNextDistanceValue(stream); if (value > LAST_DISTANCE_CODE) stream.error(); extraBits = extraDistanceBits[value];
static PngHuffmanTables getFixedTables() { return new PngHuffmanTables(); }