public int appendFromFile(FileRecords records, int start) throws IOException {
        int position = start;
        BufferSupplier bufferSupplier = new BufferSupplier.GrowableBufferSupplier();
        while (position < start + records.sizeInBytes()) {
            int bytesAppended = appendChunkFromFile(records, position, bufferSupplier);
            if (bytesAppended == 0)
                return position - start;
            position += bytesAppended;
        }
        return position - start;
    }
Append records from a file beginning at the given position until either the end of the file
is reached or an offset is found which is too large to convert to a relative offset for the indexes.

@return the number of bytes appended to the log (may be less than the size of the input if an
        offset is encountered which would overflow this segment)
storage/src/main/java/org/apache/kafka/storage/internals/log/LogSegment.java