@Override public InputStream getInputStream(InputStream inputStream) throws IOException { final InflaterInputStream is = new InflaterInputStream(inputStream); return is; }
public LiteralTableChunk read() throws Throwable { LiteralTableChunk literalTableChunk = new LiteralTableChunk(chunk()); int uncompressedSize = read4Bytes(); byte[] uncompressed = new byte[uncompressedSize]; int offset = 0; int left = uncompressedSize; try (InflaterInputStream iis = new InflaterInputStream(inputStream())) { do { int decompressed = iis.read(uncompressed, offset, left); offset += decompressed; left -= decompressed; } while (left > 0); } setInputStream(new DataInputStream(new ByteArrayInputStream(uncompressed))); int literals = read4Bytes(); while (literals-- > 0) { read4Bytes(); // length of literal literalTableChunk.add(readTerm()); } return literalTableChunk; }
public int read() throws IOException { if (closed) { throw new IOException("Stream closed"); } return read(byte1, 0, 1) == -1 ? -1 : byte1[0] & 0xff; }
public void close() throws IOException{ if(compress) deflater.end(); else iis.close(); } }
public long getTotalOut() { if(compress) return deflater.total_out; else return iis.getTotalOut(); }
public long getTotalIn() { if(compress) return deflater.total_in; else return iis.getTotalIn(); }
while(!eof) { if(inflater.avail_in==0) fill(); int err = inflater.inflate(JZlib.Z_NO_FLUSH); n += inflater.next_out_index - off;
public int read() throws IOException { if (closed) { throw new IOException("Stream closed"); } return read(byte1, 0, 1) == -1 ? -1 : byte1[0] & 0xff; }
public void close() throws IOException{ if(compress) deflater.end(); else iis.close(); } }
public long getTotalOut() { if(compress) return deflater.total_out; else return iis.getTotalOut(); }
public long getTotalIn() { if(compress) return deflater.total_in; else return iis.getTotalIn(); }
while(!eof) { if(inflater.avail_in==0) fill(); int err = inflater.inflate(JZlib.Z_NO_FLUSH); n += inflater.next_out_index - off;
public ZInputStream(InputStream in, boolean nowrap) throws IOException { super(in); iis = new InflaterInputStream(in, nowrap); compress=false; }
public int read() throws IOException { if (closed) { throw new IOException("Stream closed"); } return read(byte1, 0, 1) == -1 ? -1 : byte1[0] & 0xff; }
public void close() throws IOException{ if(compress) deflater.end(); else iis.close(); } }
public long getTotalOut() { if(compress) return deflater.total_out; else return iis.getTotalOut(); }
public long getTotalIn() { if(compress) return deflater.total_in; else return iis.getTotalIn(); }
while(!eof) { if(inflater.avail_in==0) fill(); int err = inflater.inflate(JZlib.Z_NO_FLUSH); n += inflater.next_out_index - off;
@Override public InputStream getInputStream(InputStream inputStream) throws IOException { final InflaterInputStream is = new InflaterInputStream(inputStream); return is; }
public long skip(long n) throws IOException { if (n < 0) { throw new IllegalArgumentException("negative skip length"); } if (closed) { throw new IOException("Stream closed"); } int max = (int)Math.min(n, Integer.MAX_VALUE); int total = 0; while (total < max) { int len = max - total; if (len > b.length) { len = b.length; } len = read(b, 0, len); if (len == -1) { eof = true; break; } total += len; } return total; }