Search in sources :

Example 6 with MutableDirectBuffer

use of org.agrona.MutableDirectBuffer in project deeplearning4j by deeplearning4j.

the class SbeStorageMetaData method decode.

@Override
public void decode(byte[] decode) {
    MutableDirectBuffer buffer = new UnsafeBuffer(decode);
    decode(buffer);
}
Also used : MutableDirectBuffer(org.agrona.MutableDirectBuffer) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer)

Example 7 with MutableDirectBuffer

use of org.agrona.MutableDirectBuffer in project deeplearning4j by deeplearning4j.

the class SbeStorageMetaData method encode.

@Override
public byte[] encode() {
    byte[] bytes = new byte[encodingLengthBytes()];
    MutableDirectBuffer buffer = new UnsafeBuffer(bytes);
    encode(buffer);
    return bytes;
}
Also used : MutableDirectBuffer(org.agrona.MutableDirectBuffer) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer)

Example 8 with MutableDirectBuffer

use of org.agrona.MutableDirectBuffer in project Aeron by real-logic.

the class EventLogger method logString.

private void logString(final EventCode code, final String value) {
    final MutableDirectBuffer encodedBuffer = ENCODING_BUFFER.get();
    final int encodingLength = EventEncoder.encode(encodedBuffer, value);
    ringBuffer.write(code.id(), encodedBuffer, 0, encodingLength);
}
Also used : MutableDirectBuffer(org.agrona.MutableDirectBuffer)

Example 9 with MutableDirectBuffer

use of org.agrona.MutableDirectBuffer in project Aeron by real-logic.

the class EventLogger method logFrameOut.

public void logFrameOut(final ByteBuffer buffer, final InetSocketAddress dstAddress) {
    if (IS_FRAME_OUT_ENABLED) {
        final MutableDirectBuffer encodedBuffer = ENCODING_BUFFER.get();
        final int encodedLength = EventEncoder.encode(encodedBuffer, buffer, buffer.position(), buffer.remaining(), dstAddress);
        ringBuffer.write(EventCode.FRAME_OUT.id(), encodedBuffer, 0, encodedLength);
    }
}
Also used : MutableDirectBuffer(org.agrona.MutableDirectBuffer)

Example 10 with MutableDirectBuffer

use of org.agrona.MutableDirectBuffer in project Aeron by real-logic.

the class EventLogger method logFrameIn.

public void logFrameIn(final DirectBuffer buffer, final int offset, final int length, final InetSocketAddress dstAddress) {
    if (IS_FRAME_IN_ENABLED) {
        final MutableDirectBuffer encodedBuffer = ENCODING_BUFFER.get();
        final int encodedLength = EventEncoder.encode(encodedBuffer, buffer, offset, length, dstAddress);
        ringBuffer.write(EventCode.FRAME_IN.id(), encodedBuffer, 0, encodedLength);
    }
}
Also used : MutableDirectBuffer(org.agrona.MutableDirectBuffer)

Aggregations

MutableDirectBuffer (org.agrona.MutableDirectBuffer)11 UnsafeBuffer (org.agrona.concurrent.UnsafeBuffer)6 Before (org.junit.Before)1