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

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

本文整理了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

@Override
public void put(String key, Object value) {
  Object entry = value;
  if (value instanceof byte[]) {
    entry = new Binary((byte[]) value);
  }
  messageBodyMap.put(key, entry);
}

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

public EventDataImpl(byte[] data) {
  this();
  if (data == null) {
    throw new IllegalArgumentException("data cannot be null");
  }
  this.bodyData = new Binary(data);
}

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

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);
}

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

@Override
public void put(String key, Object value) {
  Object entry = value;
  if (value instanceof byte[]) {
    entry = new Binary((byte[]) value);
  }
  messageBodyMap.put(key, entry);
}

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

@Override
public void putBinary(byte[] bytes)
{
  putBinary(new Binary(bytes));
}

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

@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;
}

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

@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;
}

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

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;
}

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

@Override
public void putBinary(byte[] bytes)
{
  putBinary(new Binary(bytes));
}

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

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;
  }
}

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

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));
}

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

@Override
public Binary encode()
{
  byte[] data = new byte[(int)encodedSize()];
  ByteBuffer buf = ByteBuffer.wrap(data);
  encode(buf);
  return new Binary(data);
}

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

@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;
}

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

/**
* 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);
}

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

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;
}

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

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);
}

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

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);
}

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

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;
}

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

@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);
  }
}

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

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());
}

相关文章