public boolean write(final int msgTypeId, final DirectBuffer srcBuffer, final int srcIndex, final int length)
    {
        checkTypeId(msgTypeId);
        checkMsgLength(length);

        boolean isSuccessful = false;

        final AtomicBuffer buffer = this.buffer;
        final int recordLength = length + HEADER_LENGTH;
        final int requiredCapacity = align(recordLength, ALIGNMENT);
        final int recordIndex = claimCapacity(buffer, requiredCapacity);

        if (INSUFFICIENT_CAPACITY != recordIndex)
        {
            buffer.putIntOrdered(lengthOffset(recordIndex), -recordLength);
            UnsafeAccess.UNSAFE.storeFence();

            buffer.putInt(typeOffset(recordIndex), msgTypeId);
            buffer.putBytes(encodedMsgOffset(recordIndex), srcBuffer, srcIndex, length);
            buffer.putIntOrdered(lengthOffset(recordIndex), recordLength);

            isSuccessful = true;
        }

        return isSuccessful;
    }
public boolean write ( final int msgTypeId , final DirectBuffer srcBuffer , final int srcIndex , final int length ) { checkTypeId ( msgTypeId ) ; checkMsgLength ( length ) ; boolean isSuccessful = false ; final AtomicBuffer buffer = this . buffer ; final int recordLength = length + HEADER_LENGTH ; final int requiredCapacity = align ( recordLength , ALIGNMENT ) ; final int recordIndex = claimCapacity ( buffer , requiredCapacity ) ; if ( INSUFFICIENT_CAPACITY != recordIndex ) { buffer . putIntOrdered ( lengthOffset ( recordIndex ) , - recordLength ) ; UnsafeAccess . UNSAFE . storeFence ( ) ; buffer . putInt ( typeOffset ( recordIndex ) , msgTypeId ) ; buffer . putBytes ( encodedMsgOffset ( recordIndex ) , srcBuffer , srcIndex , length ) ; buffer . putIntOrdered ( lengthOffset ( recordIndex ) , recordLength ) ; isSuccessful = true ; } return isSuccessful ; }
{@inheritDoc}