public StringBuilder appendTo(final StringBuilder builder) { MessageHeaderDecoder writer = new MessageHeaderDecoder(); writer.wrap(buffer, offset); return writer.appendTo(builder); } }
public StringBuilder appendTo(final StringBuilder builder) { builder.append('('); //Token{signal=ENCODING, name='blockLength', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=2, offset=0, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=UINT16, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}} builder.append("blockLength="); builder.append(blockLength()); builder.append('|'); //Token{signal=ENCODING, name='templateId', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=2, offset=2, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=UINT16, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}} builder.append("templateId="); builder.append(templateId()); builder.append('|'); //Token{signal=ENCODING, name='schemaId', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=2, offset=4, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=UINT16, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}} builder.append("schemaId="); builder.append(schemaId()); builder.append('|'); //Token{signal=ENCODING, name='version', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=2, offset=6, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=UINT16, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}} builder.append("version="); builder.append(version()); builder.append(')'); return builder; } }
@Test public void shouldDecodeCorrectly() { final ByteBuffer encodedMsgBuffer = ByteBuffer.allocate(MSG_BUFFER_CAPACITY); encodeTestMessage(encodedMsgBuffer); final DirectBuffer decodeBuffer = new UnsafeBuffer(encodedMsgBuffer); final MessageHeaderDecoder hdrDecoder = new MessageHeaderDecoder(); final MsgDecoder msgDecoder = new MsgDecoder(); hdrDecoder.wrap(decodeBuffer, 0); msgDecoder.wrap( decodeBuffer, hdrDecoder.encodedLength(), MSG_ENCODER.sbeBlockLength(), MSG_ENCODER.sbeSchemaVersion()); assertThat(hdrDecoder.blockLength(), is(22)); assertThat(hdrDecoder.templateId(), is(1)); assertThat(hdrDecoder.schemaId(), is(3)); assertThat(hdrDecoder.version(), is(0)); assertThat(msgDecoder.structure().enumOne(), is(EnumOne.Value10)); assertThat(msgDecoder.structure().zeroth(), is((short)42)); assertThat(msgDecoder.structure().setOne().bit0(), is(false)); assertThat(msgDecoder.structure().setOne().bit16(), is(true)); assertThat(msgDecoder.structure().setOne().bit26(), is(false)); assertThat(msgDecoder.structure().inner().first(), is(101L)); assertThat(msgDecoder.structure().inner().second(), is(202L)); assertThat(msgDecoder.encodedLength(), is(22)); }
Request(final Integer destination, final BufferWriter writer, final Duration timeout) { this.request = writer; this.requestBuffer = new ExpandableArrayBuffer(writer.getLength()); this.response = new CompletableActorFuture<>(); this.destination = destination; this.timeout = timeout; writer.write(this.requestBuffer, 0); final MessageHeaderDecoder headerDecoder = new MessageHeaderDecoder(); this.templateId = headerDecoder.wrap(this.requestBuffer, 0).templateId(); }
public String toString() { return appendTo(new StringBuilder(100)).toString(); }
Request(final Integer destination, final BufferWriter writer, final Duration timeout) { this.request = writer; this.requestBuffer = new ExpandableArrayBuffer(writer.getLength()); this.response = new CompletableActorFuture<>(); this.destination = destination; this.timeout = timeout; writer.write(this.requestBuffer, 0); final MessageHeaderDecoder headerDecoder = new MessageHeaderDecoder(); this.templateId = headerDecoder.wrap(this.requestBuffer, 0).templateId(); }
public String toString() { return appendTo(new StringBuilder(100)).toString(); }
public StringBuilder appendTo(final StringBuilder builder) { builder.append('('); //Token{signal=ENCODING, name='blockLength', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=2, offset=0, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=UINT16, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}} builder.append("blockLength="); builder.append(blockLength()); builder.append('|'); //Token{signal=ENCODING, name='templateId', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=2, offset=2, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=UINT16, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}} builder.append("templateId="); builder.append(templateId()); builder.append('|'); //Token{signal=ENCODING, name='schemaId', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=2, offset=4, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=UINT16, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}} builder.append("schemaId="); builder.append(schemaId()); builder.append('|'); //Token{signal=ENCODING, name='version', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=2, offset=6, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=UINT16, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}} builder.append("version="); builder.append(version()); builder.append(')'); return builder; } }
public StringBuilder appendTo(final StringBuilder builder) { MessageHeaderDecoder writer = new MessageHeaderDecoder(); writer.wrap(buffer, offset); return writer.appendTo(builder); } }
public String toString() { return appendTo(new StringBuilder(100)).toString(); }
public StringBuilder appendTo(final StringBuilder builder) { builder.append('('); //Token{signal=ENCODING, name='blockLength', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=2, offset=0, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=UINT16, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}} builder.append("blockLength="); builder.append(blockLength()); builder.append('|'); //Token{signal=ENCODING, name='templateId', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=2, offset=2, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=UINT16, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}} builder.append("templateId="); builder.append(templateId()); builder.append('|'); //Token{signal=ENCODING, name='schemaId', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=2, offset=4, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=UINT16, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}} builder.append("schemaId="); builder.append(schemaId()); builder.append('|'); //Token{signal=ENCODING, name='version', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=2, offset=6, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=UINT16, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}} builder.append("version="); builder.append(version()); builder.append(')'); return builder; } }
public StringBuilder appendTo(final StringBuilder builder) { MessageHeaderDecoder writer = new MessageHeaderDecoder(); writer.wrap(buffer, offset); return writer.appendTo(builder); } }