@Test public void read() throws Exception { try (FileChannelReader reader = new FileChannelReader(file, 0)) { ByteBuffer buf = reader.allocateByteBuffer(32); buf.order(ByteOrder.BIG_ENDIAN); int rlen = reader.read(buf); buf.flip(); assertEquals(8, rlen); assertEquals(8, buf.limit()); assertEquals(data.getInt(), buf.getInt()); assertEquals(data.getInt(), buf.getInt()); } }
@Override public int read(ByteBuffer data) throws IOException { final int rlen = fd.read(data, offset); if (rlen == -1) throw new EOFException("no more data (file end)"); offset += rlen; return rlen; }
FileChannelReader implements FileReader { @Override public int read(ByteBuffer data) throws IOException { final int rlen = fd.read(data, offset); if (rlen == -1) throw new EOFException("no more data (file end)"); offset += rlen; return rlen; } }
FileChannelReader implements FileReader { @Override public int read(ByteBuffer data) throws IOException { final int rlen = fd.read(data, offset); if (rlen == -1) throw new EOFException("no more data (file end)"); offset += rlen; return rlen; }  }
FileChannelReader implements FileReader { @Override public int read(ByteBuffer data) throws IOException { final int rlen = fd.read(data, offset); if (rlen == -1) throw new EOFException("no more data (file end)"); offset += rlen; return rlen; }  @Override int read(ByteBuffer data); @Override void close(); @Override ByteBuffer allocateByteBuffer(int size); }
FileChannelReader implements FileReader { @Override public int read(ByteBuffer data) throws IOException { final int rlen = fd.read(data, offset); if (rlen == -1) throw new EOFException("no more data (file end)"); offset += rlen; return rlen; }  @Override int read(ByteBuffer data); @Override void close(); @Override ByteBuffer allocateByteBuffer(int size);  }