public ErrorResponseDecoder wrap( final DirectBuffer buffer, final int offset, final int actingBlockLength, final int actingVersion) { if (buffer != this.buffer) { this.buffer = buffer; } this.offset = offset; this.actingBlockLength = actingBlockLength; this.actingVersion = actingVersion; limit(offset + actingBlockLength); return this; }
public ErrorResponseDecoder wrap( final DirectBuffer buffer, final int offset, final int actingBlockLength, final int actingVersion) { if (buffer != this.buffer) { this.buffer = buffer; } this.offset = offset; this.actingBlockLength = actingBlockLength; this.actingVersion = actingVersion; limit(offset + actingBlockLength); return this; }
public void wrapErrorData(final DirectBuffer wrapBuffer) { final int headerLength = 2; final int limit = parentMessage.limit(); final int dataLength = (int)(buffer.getShort(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF); parentMessage.limit(limit + headerLength + dataLength); wrapBuffer.wrap(buffer, limit + headerLength, dataLength); }
public int errorDataLength() { final int limit = parentMessage.limit(); return (int)(buffer.getShort(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF); }
public int getErrorData(final MutableDirectBuffer dst, final int dstOffset, final int length) { final int headerLength = 2; final int limit = parentMessage.limit(); final int dataLength = (int)(buffer.getShort(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF); final int bytesCopied = Math.min(length, dataLength); parentMessage.limit(limit + headerLength + dataLength); buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied); return bytesCopied; }
public int getErrorData(final MutableDirectBuffer dst, final int dstOffset, final int length) { final int headerLength = 2; final int limit = parentMessage.limit(); final int dataLength = (int)(buffer.getShort(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF); final int bytesCopied = Math.min(length, dataLength); parentMessage.limit(limit + headerLength + dataLength); buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied); return bytesCopied; }
public int getErrorData(final byte[] dst, final int dstOffset, final int length) { final int headerLength = 2; final int limit = parentMessage.limit(); final int dataLength = (int)(buffer.getShort(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF); final int bytesCopied = Math.min(length, dataLength); parentMessage.limit(limit + headerLength + dataLength); buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied); return bytesCopied; }
public int errorDataLength() { final int limit = parentMessage.limit(); return (int)(buffer.getShort(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF); }
public int getErrorData(final byte[] dst, final int dstOffset, final int length) { final int headerLength = 2; final int limit = parentMessage.limit(); final int dataLength = (int)(buffer.getShort(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF); final int bytesCopied = Math.min(length, dataLength); parentMessage.limit(limit + headerLength + dataLength); buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied); return bytesCopied; }
public void wrapErrorData(final DirectBuffer wrapBuffer) { final int headerLength = 2; final int limit = parentMessage.limit(); final int dataLength = (int)(buffer.getShort(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF); parentMessage.limit(limit + headerLength + dataLength); wrapBuffer.wrap(buffer, limit + headerLength, dataLength); }
public String errorData() { final int headerLength = 2; final int limit = parentMessage.limit(); final int dataLength = (int)(buffer.getShort(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF); parentMessage.limit(limit + headerLength + dataLength); if (0 == dataLength) { return ""; } final byte[] tmp = new byte[dataLength]; buffer.getBytes(limit + headerLength, tmp, 0, dataLength); final String value; try { value = new String(tmp, "UTF-8"); } catch (final java.io.UnsupportedEncodingException ex) { throw new RuntimeException(ex); } return value; }
public String errorData() { final int headerLength = 2; final int limit = parentMessage.limit(); final int dataLength = (int)(buffer.getShort(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF); parentMessage.limit(limit + headerLength + dataLength); if (0 == dataLength) { return ""; } final byte[] tmp = new byte[dataLength]; buffer.getBytes(limit + headerLength, tmp, 0, dataLength); final String value; try { value = new String(tmp, "UTF-8"); } catch (final java.io.UnsupportedEncodingException ex) { throw new RuntimeException(ex); } return value; }
@Override public void wrap(DirectBuffer buffer, int offset, int length) { reset(); final int frameEnd = offset + length; headerDecoder.wrap(buffer, offset); offset += headerDecoder.encodedLength(); bodyDecoder.wrap(buffer, offset, headerDecoder.blockLength(), headerDecoder.version()); errorCode = bodyDecoder.errorCode(); offset += bodyDecoder.sbeBlockLength(); final int errorDataLength = bodyDecoder.errorDataLength(); offset += ErrorResponseDecoder.errorDataHeaderLength(); errorData.wrap(buffer, offset, errorDataLength); offset += errorDataLength; bodyDecoder.limit(offset); assert bodyDecoder.limit() == frameEnd : "Decoder read only to position " + bodyDecoder.limit() + " but expected " + frameEnd + " as final position"; }
@Override public void wrap(DirectBuffer responseBuffer, int offset, int length) { messageHeaderDecoder.wrap(responseBuffer, 0); if (messageHeaderDecoder.templateId() != bodyDecoder.sbeTemplateId()) { throw new RuntimeException("Unexpected response from broker."); } bodyDecoder.wrap( responseBuffer, messageHeaderDecoder.encodedLength(), messageHeaderDecoder.blockLength(), messageHeaderDecoder.version()); final int errorDataLength = bodyDecoder.errorDataLength(); final int errorDataOffset = messageHeaderDecoder.encodedLength() + messageHeaderDecoder.blockLength() + ErrorResponseDecoder.errorDataHeaderLength(); errorData = responseBuffer.getStringWithoutLengthUtf8(errorDataOffset, errorDataLength); bodyDecoder.limit(errorDataOffset + errorDataLength); } }
@Override public void wrap(DirectBuffer responseBuffer, int offset, int length) { messageHeaderDecoder.wrap(responseBuffer, 0); if (messageHeaderDecoder.templateId() != bodyDecoder.sbeTemplateId()) { throw new RuntimeException("Unexpected response from broker."); } bodyDecoder.wrap( responseBuffer, messageHeaderDecoder.encodedLength(), messageHeaderDecoder.blockLength(), messageHeaderDecoder.version()); final int errorDataLength = bodyDecoder.errorDataLength(); final int errorDataOffset = messageHeaderDecoder.encodedLength() + messageHeaderDecoder.blockLength() + ErrorResponseDecoder.errorDataHeaderLength(); errorData = responseBuffer.getStringWithoutLengthUtf8(errorDataOffset, errorDataLength); bodyDecoder.limit(errorDataOffset + errorDataLength); } }