/** * The stream starts with the uncompressed length (up to a maximum of 2^32 - * 1), stored as a little-endian varint. Varints consist of a series of * bytes, where the lower 7 bits are data and the upper bit is set iff there * are more bytes to be read. In other words, an uncompressed length of 64 * would be stored as 0x40, and an uncompressed length of 2097150 (0x1FFFFE) * would be stored as 0xFE 0xFF 0x7F. * * @return The size of the uncompressed data * * @throws IOException * Could not read a byte */ private long readSize() throws IOException { int index = 0; long sz = 0; int b = 0; do { b = readOneByte(); if (b == -1) { throw new IOException("Premature end of stream reading size"); } sz |= (b & 0x7f) << (index++ * 7); } while (0 != (b & 0x80)); return sz; }
private int readLiteralLength(final int b) throws IOException { int length; switch (b >> 2) { case 60: length = readOneByte(); if (length == -1) { throw new IOException("Premature end of stream reading literal length"); } break; case 61: length = (int) ByteUtils.fromLittleEndian(supplier, 2); break; case 62: length = (int) ByteUtils.fromLittleEndian(supplier, 3); break; case 63: length = (int) ByteUtils.fromLittleEndian(supplier, 4); break; default: length = b >> 2; break; } return length + 1; }
int b = readOneByte(); if (b == -1) { throw new IOException("Premature end of stream reading block start"); uncompressedBytesRemaining -= length; offset = (b & 0xE0) << 3; b = readOneByte(); if (b == -1) { throw new IOException("Premature end of stream reading back-reference length");
/** * The stream starts with the uncompressed length (up to a maximum of 2^32 - * 1), stored as a little-endian varint. Varints consist of a series of * bytes, where the lower 7 bits are data and the upper bit is set iff there * are more bytes to be read. In other words, an uncompressed length of 64 * would be stored as 0x40, and an uncompressed length of 2097150 (0x1FFFFE) * would be stored as 0xFE 0xFF 0x7F. * * @return The size of the uncompressed data * * @throws IOException * Could not read a byte */ private long readSize() throws IOException { int index = 0; long sz = 0; int b = 0; do { b = readOneByte(); if (b == -1) { throw new IOException("Premature end of stream reading size"); } sz |= (b & 0x7f) << (index++ * 7); } while (0 != (b & 0x80)); return sz; }
private int readLiteralLength(final int b) throws IOException { int length; switch (b >> 2) { case 60: length = readOneByte(); if (length == -1) { throw new IOException("Premature end of stream reading literal length"); } break; case 61: length = (int) ByteUtils.fromLittleEndian(supplier, 2); break; case 62: length = (int) ByteUtils.fromLittleEndian(supplier, 3); break; case 63: length = (int) ByteUtils.fromLittleEndian(supplier, 4); break; default: length = b >> 2; break; } return length + 1; }
int b = readOneByte(); if (b == -1) { throw new IOException("Premature end of stream reading block start"); uncompressedBytesRemaining -= length; offset = (b & 0xE0) << 3; b = readOneByte(); if (b == -1) { throw new IOException("Premature end of stream reading back-reference length");