static Binary integerToTransactionId(final int txnId) { byte[] data = new byte[4]; data[3] = (byte) (txnId & 0xff); data[2] = (byte) ((txnId & 0xff00) >> 8); data[1] = (byte) ((txnId & 0xff0000) >> 16); data[0] = (byte) ((txnId & 0xff000000) >> 24); return new Binary(data); }
public BinaryWriter(final Binary object) { super(object.getArray()); }
for(EncodingRetainingSection<?> section : bodySections) totalSize += ((DataSection)section).getValue().getArray().length; for(EncodingRetainingSection<?> section : bodySections) buf.put(((DataSection) section).getValue().asByteBuffer());
error.setDescription("Unknown transactionId " + transactionIdAsBinary.toString());
.equals(transfer.getDeliveryTag()))
private byte[] getUserIdAsBytes(final Message_1_0 serverMsg) { Binary userId = getUserId(serverMsg); if (userId != null) { return userId.getArray(); } return null; }
static Object fixValue(final Object value) { if(value instanceof byte[]) { return new Binary((byte[])value); } else if(value instanceof Map) { return fixMapValues((Map)value); } else if(value instanceof List) { return fixListValues((List)value); } else { return value; } }
static Integer transactionIdToInteger(final Binary txnId) { if (txnId == null) { throw new UnknownTransactionException("'null' is not a valid transaction-id."); } byte[] data = txnId.getArray(); if (data.length > 4) { throw new IllegalArgumentException("transaction-id cannot have more than 32-bit."); } int id = 0; for (int i = 0; i < data.length; i++) { id <<= 8; id |= ((int) data[i] & 0xff); } return id; }
private AMQShortString getUserIdAsShortString(final Message_1_0 serverMsg) { Binary userId = getUserId(serverMsg); if (userId != null) { try { return AMQShortString.createAMQShortString(userId.getArray()); } catch (IllegalArgumentException e) { return null; } } return null; }
@Override public String getUserId() { if (_propertiesSection == null || _propertiesSection.getValue().getUserId() == null) { return null; } else { if (_decodedUserId.get() == null) { Binary encodededUserId = _propertiesSection.getValue().getUserId(); _decodedUserId.set(new String(encodededUserId.getArray(), StandardCharsets.UTF_8)); } return _decodedUserId.get(); } }
private void continueSaslNegotiation(final byte[] challenge) { SaslChallenge challengeBody = new SaslChallenge(); challengeBody.setChallenge(new Binary(challenge)); send(new SASLFrame(challengeBody)); _connectionState = ConnectionState.AWAIT_SASL_RESPONSE; }
return UUID.nameUUIDFromBytes(((Binary) messageId).getArray());
@Override public Binary construct(final QpidByteBuffer in, final ValueHandler handler) throws AmqpErrorException { int size; if (!in.hasRemaining(getSize())) { throw new AmqpErrorException(AmqpError.DECODE_ERROR, "Cannot construct binary: insufficient input data"); } if (getSize() == 1) { size = in.getUnsignedByte(); } else { size = in.getInt(); } if (!in.hasRemaining(size)) { throw new AmqpErrorException(AmqpError.DECODE_ERROR, "Cannot construct binary: insufficient input data"); } byte[] data = new byte[size]; in.get(data); return new Binary(data); } }
@Override public void receiveSaslResponse(final SaslResponse saslResponse) { assertState(ConnectionState.AWAIT_SASL_RESPONSE); final Binary responseBinary = saslResponse.getResponse(); byte[] response = responseBinary == null ? new byte[0] : responseBinary.getArray(); processSaslResponse(response); }
private AMQShortString covertMessageIdTo08MessageId(final Object messageId) { if (messageId == null) { return null; } final AMQShortString result; if (messageId instanceof Binary) { result = AMQShortString.createAMQShortString(((Binary) messageId).getArray()); } else if (messageId instanceof byte[]) { result = AMQShortString.createAMQShortString((byte[]) messageId); } else { result = AMQShortString.createAMQShortString(String.valueOf(messageId)); } return result; }
props.setUserId(new Binary(contentHeader.getUserId().getBytes()));
correlationId = ((Binary) correlationIdObject).getArray();