private long nextRecordOffset(long recordOffsetInFile,
                                int totalRecordLength) {
    AlignmentUtils.assert32bAligned(recordOffsetInFile, "recordOffsetInFile");
    long nextRecordOffset = AlignmentUtils.roundUpToInt32(recordOffsetInFile + totalRecordLength);

    int pageSize = storage.pageSize();
    int offsetInPage = storage.toOffsetInPage(nextRecordOffset);
    int remainingOnPage = pageSize - offsetInPage;
    if (remainingOnPage < RecordLayout.RECORD_HEADER_SIZE) {
      throw new IllegalStateException(
        "remainingOnPage(=" + remainingOnPage + ") <= recordHeader(=" + RecordLayout.RECORD_HEADER_SIZE + ")");
    }
    return nextRecordOffset;
  }
private long nextRecordOffset(long recordOffsetInFile,
                                int totalRecordLength)