TrueZipReader extends AbstractReadOnlyFile { @Override public void seek(long position) throws IOException { ensureOpen(); if (position < 0) { throw new IOException("Cannot seek to a negative position: " + position); } if (position >= reader.length()) { throw new IOException("Cannot seek past the end of data with length " + reader.length() + ". Seek position was " + position); } filePointer = position; } TrueZipReader(final WindowReader reader);  TrueZipReader(final WindowReader reader, final boolean closeReaderIfClosed); @Override long length(); @Override long getFilePointer(); @Override int read(); @Override void seek(long position); @Override int read(byte[] bytes, int offset, int length); @Override void close();  }
@Test public void testSeek() throws Exception { for (long pos = 0; pos < 1935; pos += 23) { testSeek(pos); } }
@Test(expected = IOException.class) public void testSeekNegative() throws Exception { zip.seek(-1); }
@Test(expected = IOException.class) public void testSeekPastEnd() throws Exception { zip.seek(1000000); }