aeron-client/src/main/java/io/aeron/logbuffer/HeaderWriter.java
public void write(final UnsafeBuffer termBuffer, final int offset, final int length, final int termId)
    {
        termBuffer.putLongOrdered(offset + FRAME_LENGTH_FIELD_OFFSET, versionFlagsType | ((-length) & 0xFFFF_FFFFL));
        UnsafeAccess.UNSAFE.storeFence();

        termBuffer.putLong(offset + TERM_OFFSET_FIELD_OFFSET, sessionId | offset);
        termBuffer.putLong(offset + STREAM_ID_FIELD_OFFSET, streamId | (((long)termId) << 32));
    }
public void write(final UnsafeBuffer termBuffer, final int offset, final int length, final int termId)
    {
        termBuffer.putLongOrdered(offset + FRAME_LENGTH_FIELD_OFFSET, versionFlagsType | ((-length) & 0xFFFF_FFFFL));
        UnsafeAccess.UNSAFE.storeFence();

        termBuffer.putLong(offset + TERM_OFFSET_FIELD_OFFSET, sessionId | offset);
        termBuffer.putLong(offset + STREAM_ID_FIELD_OFFSET, streamId | (((long)termId) << 32));
    }
Write a header to the term buffer in {@link ByteOrder#LITTLE_ENDIAN} format using the minimum instructions.

@param termBuffer to be written to.
@param offset     at which the header should be written.
@param length     of the fragment including the header.
@param termId     of the current term buffer.