public String toString() { return appendTo(new StringBuilder(100)).toString(); }
public RecordMetadataEncoder wrap(final MutableDirectBuffer buffer, final int offset) { if (buffer != this.buffer) { this.buffer = buffer; } this.offset = offset; limit(offset + BLOCK_LENGTH); return this; }
@Override public int getLength() { return BLOCK_LENGTH + RecordMetadataEncoder.rejectionReasonHeaderLength() + rejectionReason.capacity(); }
@Override public void write(MutableDirectBuffer buffer, int offset) { headerEncoder.wrap(buffer, offset); headerEncoder .blockLength(encoder.sbeBlockLength()) .templateId(encoder.sbeTemplateId()) .schemaId(encoder.sbeSchemaId()) .version(encoder.sbeSchemaVersion()); offset += headerEncoder.encodedLength(); encoder.wrap(buffer, offset); encoder .recordType(recordType) .requestStreamId(requestStreamId) .requestId(requestId) .protocolVersion(protocolVersion) .valueType(valueType) .intent(intentValue) .rejectionType(rejectionType); offset += RecordMetadataEncoder.BLOCK_LENGTH; if (rejectionReason.capacity() > 0) { encoder.putRejectionReason(rejectionReason, 0, rejectionReason.capacity()); } else { buffer.putShort(offset, (short) 0); } }
public RecordMetadataEncoder wrapAndApplyHeader( final MutableDirectBuffer buffer, final int offset, final MessageHeaderEncoder headerEncoder) { headerEncoder .wrap(buffer, offset) .blockLength(BLOCK_LENGTH) .templateId(TEMPLATE_ID) .schemaId(SCHEMA_ID) .version(SCHEMA_VERSION); return wrap(buffer, offset + MessageHeaderEncoder.ENCODED_LENGTH); }
public RecordMetadataEncoder wrapAndApplyHeader( final MutableDirectBuffer buffer, final int offset, final MessageHeaderEncoder headerEncoder) { headerEncoder .wrap(buffer, offset) .blockLength(BLOCK_LENGTH) .templateId(TEMPLATE_ID) .schemaId(SCHEMA_ID) .version(SCHEMA_VERSION); return wrap(buffer, offset + MessageHeaderEncoder.ENCODED_LENGTH); }
public RecordMetadataEncoder wrap(final MutableDirectBuffer buffer, final int offset) { if (buffer != this.buffer) { this.buffer = buffer; } this.offset = offset; limit(offset + BLOCK_LENGTH); return this; }
public String toString() { return appendTo(new StringBuilder(100)).toString(); }
public RecordMetadataEncoder putRejectionReason(final DirectBuffer src, final int srcOffset, final int length) { if (length > 65534) { throw new IllegalStateException("length > maxValue for type: " + length); } final int headerLength = 2; final int limit = parentMessage.limit(); parentMessage.limit(limit + headerLength + length); buffer.putShort(limit, (short)length, java.nio.ByteOrder.LITTLE_ENDIAN); buffer.putBytes(limit + headerLength, src, srcOffset, length); return this; }
public RecordMetadataEncoder putRejectionReason(final byte[] src, final int srcOffset, final int length) { if (length > 65534) { throw new IllegalStateException("length > maxValue for type: " + length); } final int headerLength = 2; final int limit = parentMessage.limit(); parentMessage.limit(limit + headerLength + length); buffer.putShort(limit, (short)length, java.nio.ByteOrder.LITTLE_ENDIAN); buffer.putBytes(limit + headerLength, src, srcOffset, length); return this; }
public RecordMetadataEncoder putRejectionReason(final DirectBuffer src, final int srcOffset, final int length) { if (length > 65534) { throw new IllegalStateException("length > maxValue for type: " + length); } final int headerLength = 2; final int limit = parentMessage.limit(); parentMessage.limit(limit + headerLength + length); buffer.putShort(limit, (short)length, java.nio.ByteOrder.LITTLE_ENDIAN); buffer.putBytes(limit + headerLength, src, srcOffset, length); return this; }
public RecordMetadataEncoder putRejectionReason(final byte[] src, final int srcOffset, final int length) { if (length > 65534) { throw new IllegalStateException("length > maxValue for type: " + length); } final int headerLength = 2; final int limit = parentMessage.limit(); parentMessage.limit(limit + headerLength + length); buffer.putShort(limit, (short)length, java.nio.ByteOrder.LITTLE_ENDIAN); buffer.putBytes(limit + headerLength, src, srcOffset, length); return this; }
public RecordMetadataEncoder rejectionReason(final String value) { final byte[] bytes; try { bytes = null == value || value.isEmpty() ? org.agrona.collections.ArrayUtil.EMPTY_BYTE_ARRAY : value.getBytes("UTF-8"); } catch (final java.io.UnsupportedEncodingException ex) { throw new RuntimeException(ex); } final int length = bytes.length; if (length > 65534) { throw new IllegalStateException("length > maxValue for type: " + length); } final int headerLength = 2; final int limit = parentMessage.limit(); parentMessage.limit(limit + headerLength + length); buffer.putShort(limit, (short)length, java.nio.ByteOrder.LITTLE_ENDIAN); buffer.putBytes(limit + headerLength, bytes, 0, length); return this; }
public RecordMetadataEncoder rejectionReason(final String value) { final byte[] bytes; try { bytes = null == value || value.isEmpty() ? org.agrona.collections.ArrayUtil.EMPTY_BYTE_ARRAY : value.getBytes("UTF-8"); } catch (final java.io.UnsupportedEncodingException ex) { throw new RuntimeException(ex); } final int length = bytes.length; if (length > 65534) { throw new IllegalStateException("length > maxValue for type: " + length); } final int headerLength = 2; final int limit = parentMessage.limit(); parentMessage.limit(limit + headerLength + length); buffer.putShort(limit, (short)length, java.nio.ByteOrder.LITTLE_ENDIAN); buffer.putBytes(limit + headerLength, bytes, 0, length); return this; }