/** * Reads bytes by reading from the underlying stream rather than * the (potentially inflating) archive stream - which {@link #read} would do. * * Also updates bytes-read counter. */ private int readOneByte() throws IOException { final int b = in.read(); if (b != -1) { count(1); } return b; }
private int fill() throws IOException { if (closed) { throw new IOException("The stream is closed"); } final int length = in.read(buf.array()); if (length > 0) { buf.limit(length); count(buf.limit()); inf.setInput(buf.array(), 0, buf.limit()); } return length; }
/** * Skips bytes by reading from the underlying stream rather than * the (potentially inflating) archive stream - which {@link * #skip} would do. * * Also updates bytes-read counter. */ private void realSkip(final long value) throws IOException { if (value >= 0) { long skipped = 0; while (skipped < value) { final long rem = value - skipped; final int x = in.read(skipBuf, 0, (int) (skipBuf.length > rem ? rem : skipBuf.length)); if (x == -1) { return; } count(x); skipped += x; } return; } throw new IllegalArgumentException(); }
private void readFully(final byte[] b, final int off) throws IOException { final int len = b.length - off; final int count = IOUtils.readFully(in, b, off, len); count(count); if (count < len) { throw new EOFException(); } }
/** * Read all data of the current entry from the underlying stream * that hasn't been read, yet. */ private void drainCurrentEntryData() throws IOException { long remaining = current.entry.getCompressedSize() - current.bytesReadFromStream; while (remaining > 0) { final long n = in.read(buf.array(), 0, (int) Math.min(buf.capacity(), remaining)); if (n < 0) { throw new EOFException("Truncated ZIP entry: " + ArchiveUtils.sanitize(current.entry.getName())); } count(n); remaining -= n; } }
count(l); current.bytesReadFromStream += l;
/** * Reads bytes by reading from the underlying stream rather than * the (potentially inflating) archive stream - which {@link #read} would do. * * Also updates bytes-read counter. */ private int readOneByte() throws IOException { final int b = in.read(); if (b != -1) { count(1); } return b; }
private int fill() throws IOException { if (closed) { throw new IOException("The stream is closed"); } final int length = in.read(buf.array()); if (length > 0) { buf.limit(length); count(buf.limit()); inf.setInput(buf.array(), 0, buf.limit()); } return length; }
/** * Skips bytes by reading from the underlying stream rather than * the (potentially inflating) archive stream - which {@link * #skip} would do. * * Also updates bytes-read counter. */ private void realSkip(final long value) throws IOException { if (value >= 0) { long skipped = 0; while (skipped < value) { final long rem = value - skipped; final int x = in.read(skipBuf, 0, (int) (skipBuf.length > rem ? rem : skipBuf.length)); if (x == -1) { return; } count(x); skipped += x; } return; } throw new IllegalArgumentException(); }
private void readFully(final byte[] b) throws IOException { final int count = IOUtils.readFully(in, b); count(count); if (count < b.length) { throw new EOFException(); } }
/** * Read all data of the current entry from the underlying stream * that hasn't been read, yet. */ private void drainCurrentEntryData() throws IOException { long remaining = current.entry.getCompressedSize() - current.bytesReadFromStream; while (remaining > 0) { final long n = in.read(buf.array(), 0, (int) Math.min(buf.capacity(), remaining)); if (n < 0) { throw new EOFException("Truncated ZIP entry: " + ArchiveUtils.sanitize(current.entry.getName())); } count(n); remaining -= n; } }
count(l); current.bytesReadFromStream += l;