@Test public void testGet() throws Exception { PagedChannelRandomAccessSource s = new PagedChannelRandomAccessSource(channel); try{ for(int i = 0; i < data.length; i++){ int ch = s.get(i); Assert.assertFalse("EOF hit unexpectedly at " + i + " out of " + data.length, ch == -1); Assert.assertEquals("Position " + i, data[i], (byte)ch); } Assert.assertEquals(-1, s.get(data.length)); } finally { s.close(); } }
@Override public void close() throws IOException { super.close(); channel.close(); }
PagedChannelRandomAccessSource extends GroupedRandomAccessSource implements RandomAccessSource { @Override public void close() throws IOException { super.close(); channel.close(); } }
PagedChannelRandomAccessSource extends GroupedRandomAccessSource implements RandomAccessSource { @Override public void close() throws IOException { super.close(); channel.close(); } PagedChannelRandomAccessSource(FileChannel channel);  PagedChannelRandomAccessSource(final FileChannel channel, final int totalBufferSize, final int maxOpenBuffers); }
PagedChannelRandomAccessSource extends GroupedRandomAccessSource implements RandomAccessSource { @Override public void close() throws IOException { super.close(); channel.close(); } PagedChannelRandomAccessSource(FileChannel channel);  PagedChannelRandomAccessSource(final FileChannel channel, final int totalBufferSize, final int maxOpenBuffers); @Override /** * {@inheritDoc} * Cleans the mapped bytebuffers and closes the channel */ void close(); }
PagedChannelRandomAccessSource extends GroupedRandomAccessSource implements RandomAccessSource { @Override public void close() throws IOException { super.close(); channel.close(); } PagedChannelRandomAccessSource(FileChannel channel);  PagedChannelRandomAccessSource(final FileChannel channel, final int totalBufferSize, final int maxOpenBuffers); @Override /** * {@inheritDoc} * Cleans the mapped bytebuffers and closes the channel */ void close(); static final int DEFAULT_TOTAL_BUFSIZE; static final int DEFAULT_MAX_OPEN_BUFFERS; }