aeron-client/src/main/java/io/aeron/logbuffer/TermAppender.java
public int claim(
        final HeaderWriter header,
        final int length,
        final BufferClaim bufferClaim,
        final int activeTermId)
    {
        final int frameLength = length + HEADER_LENGTH;
        final int alignedLength = align(frameLength, FRAME_ALIGNMENT);
        final UnsafeBuffer termBuffer = this.termBuffer;
        final int termLength = termBuffer.capacity();

        final long rawTail = getAndAddRawTail(alignedLength);
        final int termId = termId(rawTail);
        final long termOffset = rawTail & 0xFFFF_FFFFL;

        checkTerm(activeTermId, termId);

        long resultingOffset = termOffset + alignedLength;
        if (resultingOffset > termLength)
        {
            resultingOffset = handleEndOfLogCondition(termBuffer, termOffset, header, termLength, termId);
        }
        else
        {
            final int frameOffset = (int)termOffset;
            header.write(termBuffer, frameOffset, frameLength, termId);
            bufferClaim.wrap(termBuffer, frameOffset, frameLength);
        }

        return (int)resultingOffset;
    }
public int claim(
        final HeaderWriter header,
        final int length,
        final BufferClaim bufferClaim,
        final int activeTermId)
    {
        final int frameLength = length + HEADER_LENGTH;
        final int alignedLength = align(frameLength, FRAME_ALIGNMENT);
        final UnsafeBuffer termBuffer = this.termBuffer;
        final int termLength = termBuffer.capacity();

        final long rawTail = getAndAddRawTail(alignedLength);
        final int termId = termId(rawTail);
        final long termOffset = rawTail & 0xFFFF_FFFFL;

        checkTerm(activeTermId, termId);

        long resultingOffset = termOffset + alignedLength;
        if (resultingOffset > termLength)
        {
            resultingOffset = handleEndOfLogCondition(termBuffer, termOffset, header, termLength, termId);
        }
        else
        {
            final int frameOffset = (int)termOffset;
            header.write(termBuffer, frameOffset, frameLength, termId);
            bufferClaim.wrap(termBuffer, frameOffset, frameLength);
        }

        return (int)resultingOffset;
    }
Claim length of a the term buffer for writing in the message with zero copy semantics.

@param header       for writing the default header.
@param length       of the message to be written.
@param bufferClaim  to be updated with the claimed region.
@param activeTermId used for flow control.
@return the resulting offset of the term after the append on success otherwise {@link #FAILED}.