@Override
  public void readInto(ByteBuffer buffer, long position) throws IOException {
    int size = buffer.remaining();
    validateReadRange(position, size);
    long bytesRead = 0;
    while (bytesRead < size) {
      bytesRead += fileChannel.read(buffer, position + bytesRead);
    }
  }
{@inheritDoc}
<p/>
The read is not started if it cannot be completed.
@param buffer The buffer into which the data needs to be written
@param position The position to start the read from
@throws IOException if data could not be written to the file because of I/O errors
@throws IndexOutOfBoundsException if {@code position} < header size or >= {@link #sizeInBytes()} or if
{@code buffer} size is greater than the data available for read.
ambry-store/src/main/java/com/github/ambry/store/LogSegment.java