@Test public void copyTo() throws Exception { for (int begin = 0; begin < mChain.size(); begin++) { for (int end = begin + 1; end < mChain.size(); end++) { int size = end - begin; ByteBuffer buffer = ByteBuffer.allocate(size); mChain.copyTo(begin, size, buffer); assertEquals(size, buffer.position()); buffer.rewind(); assertByteBufferEquals( ByteBuffer.wrap("1234567890".substring(begin, end).getBytes(US_ASCII)), buffer); } } }
@Override public void copyTo(long offset, int size, ByteBuffer dest) throws IOException { feed(offset, size, new ByteBufferSink(dest)); }
ChainedDataSource implements DataSource { @Override public void copyTo(long offset, int size, ByteBuffer dest) throws IOException { feed(offset, size, new ByteBufferSink(dest)); } }
ChainedDataSource implements DataSource { @Override public void copyTo(long offset, int size, ByteBuffer dest) throws IOException { feed(offset, size, new ByteBufferSink(dest)); } ChainedDataSource(DataSource... sources); }
ChainedDataSource implements DataSource { @Override public void copyTo(long offset, int size, ByteBuffer dest) throws IOException { feed(offset, size, new ByteBufferSink(dest)); } ChainedDataSource(DataSource... sources); @Override long size(); @Override void feed(long offset, long size, DataSink sink); @Override ByteBuffer getByteBuffer(long offset, int size); @Override void copyTo(long offset, int size, ByteBuffer dest); @Override DataSource slice(long offset, long size); }
ChainedDataSource implements DataSource { @Override public void copyTo(long offset, int size, ByteBuffer dest) throws IOException { feed(offset, size, new ByteBufferSink(dest)); } ChainedDataSource(DataSource... sources); @Override long size(); @Override void feed(long offset, long size, DataSink sink); @Override ByteBuffer getByteBuffer(long offset, int size); @Override void copyTo(long offset, int size, ByteBuffer dest); @Override DataSource slice(long offset, long size);  }