@Override public void put(String key, Object value) { Object entry = value; if (value instanceof byte[]) { entry = new Binary((byte[]) value); } messageBodyMap.put(key, entry); }
public EventDataImpl(byte[] data) { this(); if (data == null) { throw new IllegalArgumentException("data cannot be null"); } this.bodyData = new Binary(data); }
public EventDataImpl(byte[] data, final int offset, final int length) { this(); if (data == null) { throw new IllegalArgumentException("data cannot be null"); } this.bodyData = new Binary(data, offset, length); }
@Override public void put(String key, Object value) { Object entry = value; if (value instanceof byte[]) { entry = new Binary((byte[]) value); } messageBodyMap.put(key, entry); }
@Override public void putBinary(byte[] bytes) { putBinary(new Binary(bytes)); }
@Override final public int send(byte[] bytes, int offset, int size) { byte[] data = new byte[size]; System.arraycopy(bytes, offset, data, 0, size); setChallengeResponse(new Binary(data)); return size; }
@Override final public int send(byte[] bytes, int offset, int size) { byte[] data = new byte[size]; System.arraycopy(bytes, offset, data, 0, size); setChallengeResponse(new Binary(data)); return size; }
final public int send(byte[] bytes, int offset, int size) { byte[] data = new byte[size]; System.arraycopy(bytes, offset, data, 0, size); setChallengeResponse(new Binary(data)); return size; }
@Override public void putBinary(byte[] bytes) { putBinary(new Binary(bytes)); }
public Message createBinaryMessage(byte value[], int offset, int len) { Message msg = Message.Factory.create(); Data body = new Data(new Binary(value, offset,len)); msg.setBody(body); return msg; } }
public void plain(String username, String password) { client(); _chosenMechanism = Symbol.valueOf("PLAIN"); byte[] usernameBytes = username.getBytes(); byte[] passwordBytes = password.getBytes(); byte[] data = new byte[usernameBytes.length+passwordBytes.length+2]; System.arraycopy(usernameBytes, 0, data, 1, usernameBytes.length); System.arraycopy(passwordBytes, 0, data, 2+usernameBytes.length, passwordBytes.length); setChallengeResponse(new Binary(data)); }
@Override public Binary encode() { byte[] data = new byte[(int)encodedSize()]; ByteBuffer buf = ByteBuffer.wrap(data); encode(buf); return new Binary(data); }
@Override public void setObject(Serializable value) throws IOException { if (value == null) { parent.setBody(NULL_OBJECT_BODY); } else { byte[] bytes = getSerializedBytes(value); parent.setBody(new Data(new Binary(bytes))); } localContent = true; }
/** * Sets a byte array value into the body of an outgoing Message, throws * an exception if this is an incoming message instance. * * @param bytes the byte array value to store in the Message body. * @throws IllegalStateException if the message is read only. */ public void setBytes(byte[] bytes) throws IllegalStateException { checkReadOnly(); Data body = new Data(new Binary(bytes)); getWrappedMessage().setBody(body); }
public static ServerJMSMessage createObjectMessage(long id, byte[] array, int offset, int length, CoreMessageObjectPools coreMessageObjectPools) throws JMSException { ServerJMSObjectMessage message = createObjectMessage(id, coreMessageObjectPools); message.setSerializedForm(new Binary(array, offset, length)); return message; }
BinaryElement(Element parent, Element prev, Binary b) { super(parent, prev); byte[] data = new byte[b.getLength()]; System.arraycopy(b.getArray(),b.getArrayOffset(),data,0,b.getLength()); _value = new Binary(data); }
private static Binary getBinaryFromMessageBody(ServerJMSBytesMessage message) throws JMSException { byte[] data = new byte[(int) message.getBodyLength()]; message.readBytes(data); message.reset(); // Need to reset after readBytes or future readBytes return new Binary(data); }
public Binary newTransaction() { XidImpl xid = newXID(); Binary binary = new Binary(xid.getGlobalTransactionId()); Transaction transaction = new ProtonTransactionImpl(xid, server.getStorageManager(), -1, amqpConnection); transactions.put(binary, transaction); return binary; }
@Override public void decode() throws Exception { super.decode(); ActiveMQBuffer buffer = getInnerMessage().getDataBuffer(); int size = buffer.readInt(); byte[] bytes = new byte[size]; buffer.readBytes(bytes); payload = new Binary(bytes); } }
private void validateMessage(byte[] expectedPayload, int msgNum, AmqpMessage message) { assertNotNull("failed at " + msgNum, message); Section body = message.getWrappedMessage().getBody(); assertNotNull("No message body for msg " + msgNum, body); assertTrue("Unexpected message body type for msg " + body.getClass(), body instanceof Data); assertEquals("Unexpected body content for msg", new Binary(expectedPayload, 0, expectedPayload.length), ((Data) body).getValue()); }