FatReader implements BlockDevice { @Override public void read(final long devOffset, final ByteBuffer dest) throws IOException { ensureOpen(); final int bytesRequested = dest.remaining(); if (devOffset + bytesRequested > reader.length()) { throw new EOFException("Reading past end of device"); } ArchiveFileUtils.copyToBuffer(reader, devOffset, dest); } FatReader(final WindowReader reader); @Override long getSize(); @Override void read(final long devOffset, final ByteBuffer dest); @Override void write(long devOffset, ByteBuffer src); @Override void flush(); @Override int getSectorSize(); @Override void close(); @Override boolean isClosed(); @Override String toString(); @Override boolean isReadOnly();  }
@Test public void testRead() throws Exception { testRead(0, 1024); testRead(1024, 96); testRead(33, 2); }