/** * This method skips {@code toSkip} bytes in the given input stream * using the given buffer unless EOF or IOException. */ @Override public long skip(long toSkip) throws IOException { long total = 0; final byte[] buf = new byte[size]; for (long len; (len = toSkip - total) > 0; total += len) { len = read(buf, 0, len < buf.length ? (int) len : buf.length); if (len < 0) { break; } } return total; }
@Override public void close() throws IOException { if (!closed) { while (skip(Long.MAX_VALUE) > 0) { // process CRC-32 until EOF } } super.close(); closed = true; final long expected = entry.getCrc(); final long computed = getChecksum().getValue(); if (expected != computed) throw new CRC32Exception(entry.getName(), expected, computed); } }
in = new Crc32InputStream(in, entry, bufSize); return in; } catch (final IOException ex) {