org.apache.qpid.proton.amqp.Binary.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(161)

本文整理了Java中org.apache.qpid.proton.amqp.Binary.<init>()方法的一些代码示例,展示了Binary.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Binary.<init>()方法的具体详情如下:
包路径:org.apache.qpid.proton.amqp.Binary
类名称:Binary
方法名:<init>

Binary.<init>介绍

暂无

代码示例

代码示例来源:origin: org.apache.qpid/qpid-jms-client

  1. @Override
  2. public void put(String key, Object value) {
  3. Object entry = value;
  4. if (value instanceof byte[]) {
  5. entry = new Binary((byte[]) value);
  6. }
  7. messageBodyMap.put(key, entry);
  8. }

代码示例来源:origin: Azure/azure-event-hubs-java

  1. public EventDataImpl(byte[] data) {
  2. this();
  3. if (data == null) {
  4. throw new IllegalArgumentException("data cannot be null");
  5. }
  6. this.bodyData = new Binary(data);
  7. }

代码示例来源:origin: Azure/azure-event-hubs-java

  1. public EventDataImpl(byte[] data, final int offset, final int length) {
  2. this();
  3. if (data == null) {
  4. throw new IllegalArgumentException("data cannot be null");
  5. }
  6. this.bodyData = new Binary(data, offset, length);
  7. }

代码示例来源:origin: apache/qpid-jms

  1. @Override
  2. public void put(String key, Object value) {
  3. Object entry = value;
  4. if (value instanceof byte[]) {
  5. entry = new Binary((byte[]) value);
  6. }
  7. messageBodyMap.put(key, entry);
  8. }

代码示例来源:origin: org.apache.qpid/proton-j

  1. @Override
  2. public void putBinary(byte[] bytes)
  3. {
  4. putBinary(new Binary(bytes));
  5. }

代码示例来源:origin: org.apache.qpid/proton-j

  1. @Override
  2. final public int send(byte[] bytes, int offset, int size)
  3. {
  4. byte[] data = new byte[size];
  5. System.arraycopy(bytes, offset, data, 0, size);
  6. setChallengeResponse(new Binary(data));
  7. return size;
  8. }

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

  1. @Override
  2. final public int send(byte[] bytes, int offset, int size)
  3. {
  4. byte[] data = new byte[size];
  5. System.arraycopy(bytes, offset, data, 0, size);
  6. setChallengeResponse(new Binary(data));
  7. return size;
  8. }

代码示例来源:origin: org.apache.qpid/proton

  1. final public int send(byte[] bytes, int offset, int size)
  2. {
  3. byte[] data = new byte[size];
  4. System.arraycopy(bytes, offset, data, 0, size);
  5. setChallengeResponse(new Binary(data));
  6. return size;
  7. }

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

  1. @Override
  2. public void putBinary(byte[] bytes)
  3. {
  4. putBinary(new Binary(bytes));
  5. }

代码示例来源:origin: org.apache.qpid/proton-hawtdispatch

  1. public Message createBinaryMessage(byte value[], int offset, int len) {
  2. Message msg = Message.Factory.create();
  3. Data body = new Data(new Binary(value, offset,len));
  4. msg.setBody(body);
  5. return msg;
  6. }
  7. }

代码示例来源:origin: org.apache.qpid/proton

  1. public void plain(String username, String password)
  2. {
  3. client();
  4. _chosenMechanism = Symbol.valueOf("PLAIN");
  5. byte[] usernameBytes = username.getBytes();
  6. byte[] passwordBytes = password.getBytes();
  7. byte[] data = new byte[usernameBytes.length+passwordBytes.length+2];
  8. System.arraycopy(usernameBytes, 0, data, 1, usernameBytes.length);
  9. System.arraycopy(passwordBytes, 0, data, 2+usernameBytes.length, passwordBytes.length);
  10. setChallengeResponse(new Binary(data));
  11. }

代码示例来源:origin: org.apache.qpid/proton-j

  1. @Override
  2. public Binary encode()
  3. {
  4. byte[] data = new byte[(int)encodedSize()];
  5. ByteBuffer buf = ByteBuffer.wrap(data);
  6. encode(buf);
  7. return new Binary(data);
  8. }

代码示例来源:origin: org.apache.qpid/qpid-jms-client

  1. @Override
  2. public void setObject(Serializable value) throws IOException {
  3. if (value == null) {
  4. parent.setBody(NULL_OBJECT_BODY);
  5. } else {
  6. byte[] bytes = getSerializedBytes(value);
  7. parent.setBody(new Data(new Binary(bytes)));
  8. }
  9. localContent = true;
  10. }

代码示例来源:origin: apache/activemq-artemis

  1. /**
  2. * Sets a byte array value into the body of an outgoing Message, throws
  3. * an exception if this is an incoming message instance.
  4. *
  5. * @param bytes the byte array value to store in the Message body.
  6. * @throws IllegalStateException if the message is read only.
  7. */
  8. public void setBytes(byte[] bytes) throws IllegalStateException {
  9. checkReadOnly();
  10. Data body = new Data(new Binary(bytes));
  11. getWrappedMessage().setBody(body);
  12. }

代码示例来源:origin: apache/activemq-artemis

  1. public static ServerJMSMessage createObjectMessage(long id, byte[] array, int offset, int length, CoreMessageObjectPools coreMessageObjectPools) throws JMSException {
  2. ServerJMSObjectMessage message = createObjectMessage(id, coreMessageObjectPools);
  3. message.setSerializedForm(new Binary(array, offset, length));
  4. return message;
  5. }

代码示例来源:origin: org.apache.qpid/proton-j

  1. BinaryElement(Element parent, Element prev, Binary b)
  2. {
  3. super(parent, prev);
  4. byte[] data = new byte[b.getLength()];
  5. System.arraycopy(b.getArray(),b.getArrayOffset(),data,0,b.getLength());
  6. _value = new Binary(data);
  7. }

代码示例来源:origin: org.apache.activemq/artemis-amqp-protocol

  1. private static Binary getBinaryFromMessageBody(ServerJMSBytesMessage message) throws JMSException {
  2. byte[] data = new byte[(int) message.getBodyLength()];
  3. message.readBytes(data);
  4. message.reset(); // Need to reset after readBytes or future readBytes
  5. return new Binary(data);
  6. }

代码示例来源:origin: apache/activemq-artemis

  1. public Binary newTransaction() {
  2. XidImpl xid = newXID();
  3. Binary binary = new Binary(xid.getGlobalTransactionId());
  4. Transaction transaction = new ProtonTransactionImpl(xid, server.getStorageManager(), -1, amqpConnection);
  5. transactions.put(binary, transaction);
  6. return binary;
  7. }

代码示例来源:origin: apache/activemq-artemis

  1. @Override
  2. public void decode() throws Exception {
  3. super.decode();
  4. ActiveMQBuffer buffer = getInnerMessage().getDataBuffer();
  5. int size = buffer.readInt();
  6. byte[] bytes = new byte[size];
  7. buffer.readBytes(bytes);
  8. payload = new Binary(bytes);
  9. }
  10. }

代码示例来源:origin: apache/activemq-artemis

  1. private void validateMessage(byte[] expectedPayload, int msgNum, AmqpMessage message) {
  2. assertNotNull("failed at " + msgNum, message);
  3. Section body = message.getWrappedMessage().getBody();
  4. assertNotNull("No message body for msg " + msgNum, body);
  5. assertTrue("Unexpected message body type for msg " + body.getClass(), body instanceof Data);
  6. assertEquals("Unexpected body content for msg", new Binary(expectedPayload, 0, expectedPayload.length), ((Data) body).getValue());
  7. }

相关文章