static void readFullyHeapBuffer(InputStream f, ByteBuffer buf) throws IOException {
    readFully(f, buf.array(), buf.arrayOffset() + buf.position(), buf.remaining());
    buf.position(buf.limit());
  }
@Test
  public void testHeapReadFullyLargeBuffer() throws Exception {
    final ByteBuffer readBuffer = ByteBuffer.allocate(20);

    final MockInputStream stream = new MockInputStream();

    TestUtils.assertThrows("Should throw EOFException", EOFException.class, () -> {
      DelegatingSeekableInputStream.readFullyHeapBuffer(stream, readBuffer);
      return null;
    });

    Assert.assertEquals(0, readBuffer.position());
    Assert.assertEquals(20, readBuffer.limit());
  }