SevenZipReader implements SeekableByteChannel { @Override public int read(final ByteBuffer dst) throws IOException { if (isOpen) { final int bytesCopied = ArchiveFileUtils.copyToBuffer(reader, position, dst); position += bytesCopied; return bytesCopied; } return -1; } SevenZipReader(final WindowReader reader); @Override int read(final ByteBuffer dst); @Override int write(ByteBuffer src); @Override long position(); @Override SeekableByteChannel position(long newPosition); @Override long size(); @Override SeekableByteChannel truncate(long size); @Override boolean isOpen(); @Override void close(); @Override String toString();  }
@Test public void testRead() throws Exception { testRead(0, 232); testRead(2, 2); testRead(1, 1); testRead(96, 116); }