@Test
  public void testGetIntStrictlyForwardWithPosOnMultiBuffers() throws IOException {
    byte[] b = new byte[4];
    byte[] b1 = new byte[8];
    ByteBuffer bb1 = ByteBuffer.wrap(b);
    ByteBuffer bb2 = ByteBuffer.wrap(b1);
    MultiByteBuff mbb1 = new MultiByteBuff(bb1, bb2);
    mbb1.position(2);
    mbb1.putInt(4);
    mbb1.position(7);
    mbb1.put((byte) 2);
    mbb1.putInt(3);
    mbb1.rewind();
    mbb1.getIntAfterPosition(4);
    byte res = mbb1.get(7);
    assertEquals((byte) 2, res);
    mbb1.position(7);
    int intRes = mbb1.getIntAfterPosition(1);
    assertEquals(3, intRes);
  }
Test right answer though we span many sub-buffers.
hbase-common/src/test/java/org/apache/hadoop/hbase/nio/TestMultiByteBuff.java