public ByteBuffer readBuffer(long address, int length) {
    ByteBuffer[] buffers = readBuffers(address, length);
    if (buffers.length == 1) {
      return buffers[0];
    } else {
      ByteBuffer copy = ByteBuffer.allocate(length);
      for (ByteBuffer b : buffers) {
        copy.put(b);
      }
      return ((ByteBuffer) copy.flip()).asReadOnlyBuffer();
    }
  }
public ByteBuffer readBuffer ( long address , int length ) { ByteBuffer [ ] buffers = readBuffers ( address , length ) ; if ( buffers . length == 1 ) { return buffers [ 0 ] ; } else { ByteBuffer copy = ByteBuffer . allocate ( length ) ; for ( ByteBuffer b : buffers ) { copy . put ( b ) ; } return ( ( ByteBuffer ) copy . flip ( ) ) . asReadOnlyBuffer ( ) ; } }
Read the given range and return the data as a single read-only {@code ByteBuffer}.

@param address address to read from
@param length number of bytes to read
@return a read-only buffer