DecompressorStream extends CompressionInputStream { @Override public long skip(long n) throws IOException { if (n < 0) { throw new IllegalArgumentException("negative skip length"); } checkStream(); int skipped = 0; while (skipped < n) { int len = Math.min(((int)n - skipped), skipBytes.length); len = read(skipBytes, 0, len); if (len == -1) { eof = true; break; } skipped += len; } return skipped; } @VisibleForTesting  DecompressorStream(InputStream in, Decompressor decompressor,
                            int bufferSize, int skipBufferSize);  DecompressorStream(InputStream in, Decompressor decompressor,
                            int bufferSize);  DecompressorStream(InputStream in, Decompressor decompressor); protected  DecompressorStream(InputStream in); @Override int read(); @Override int read(byte[] b, int off, int len); @Override void resetState(); @Override long skip(long n); @Override int available(); @Override void close(); @Override boolean markSupported(); @Override synchronized void mark(int readlimit); @Override synchronized void reset();  }
@Test public void testSkip() throws IOException { assertThat(decompressorStream.skip(12), is(12L)); assertThat(decompressorStream.read(), is((int)TEST_STRING.charAt(12))); assertThat(decompressorStream.read(), is((int)TEST_STRING.charAt(13))); assertThat(decompressorStream.read(), is((int)TEST_STRING.charAt(14))); assertThat(decompressorStream.skip(10), is(10L)); assertThat(decompressorStream.read(), is((int)TEST_STRING.charAt(25))); try { long ret = decompressorStream.skip(1000); fail("Not reachable but got ret " + ret); } catch (EOFException e) { } }