@Test
  public void testPositionalPutByteBuff() throws Exception {
    ByteBuffer bb1 = ByteBuffer.allocate(100);
    ByteBuffer bb2 = ByteBuffer.allocate(100);
    MultiByteBuff srcMultiByteBuff = new MultiByteBuff(bb1, bb2);
    for (int i = 0; i < 25; i++) {
      srcMultiByteBuff.putLong(i * 8L);
    }
    // Test MultiByteBuff To MultiByteBuff
    doTestPositionalPutByteBuff(srcMultiByteBuff);

    ByteBuffer bb3 = ByteBuffer.allocate(200);
    SingleByteBuff srcSingleByteBuff = new SingleByteBuff(bb3);
    for (int i = 0; i < 25; i++) {
      srcSingleByteBuff.putLong(i * 8L);
    }
    // Test SingleByteBuff To MultiByteBuff
    doTestPositionalPutByteBuff(srcSingleByteBuff);
  }
Test right answer though we span many sub-buffers.
hbase-common/src/test/java/org/apache/hadoop/hbase/nio/TestMultiByteBuff.java