long (long recordOffsetInFile, int totalRecordLength) { assert32bAligned(recordOffsetInFile, "recordOffsetInFile"); long nextRecordOffset = 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; }