private byte[] getDataFromLogSegment(LogSegment logSegment, long offset, long size) throws IOException {
    assert size <= Integer.MAX_VALUE : "Cannot read more than " + Integer.MAX_VALUE + " bytes of data";
    byte[] data = new byte[(int) size];
    FileChannel fileChannel = logSegment.getView().getSecond();
    try {
      fileChannel.read(ByteBuffer.wrap(data), offset);
    } finally {
      logSegment.closeView();
    }
    return data;
  }
@param logSegment the {@link LogSegment} to get the data from.
@param offset the offset inside {@code logSegment} to start the read at.
@param size the size of the data that must be read.
@return the bytes that were read.
@throws IOException if there was an I/O error while reading.
ambry-tools/src/main/java/com/github/ambry/store/CompactionVerifier.java