Package org.apache.qpid.proton.amqp

Examples of org.apache.qpid.proton.amqp.Binary


            {
                _properties = new Properties();
            }
            byte[] id = new byte[userId.length];
            System.arraycopy(userId, 0, id,0, userId.length);
            _properties.setUserId(new Binary(id));
        }
    }
View Full Code Here


    public void load(Object data)
    {
        switch (_format)
        {
            case DATA:
                Binary binData;
                if(data instanceof byte[])
                {
                    binData = new Binary((byte[])data);
                }
                else if(data instanceof Binary)
                {
                    binData = (Binary) data;
                }
                else if(data instanceof String)
                {
                    final String strData = (String) data;
                    byte[] bin = new byte[strData.length()];
                    for(int i = 0; i < bin.length; i++)
                    {
                        bin[i] = (byte) strData.charAt(i);
                    }
                    binData = new Binary(bin);
                }
                else
                {
                    binData = null;
                }
View Full Code Here

        return createBinaryMessage(value, 0, value.length);
    }

    public Message createBinaryMessage(byte value[], int offset, int len) {
        Message msg = new MessageImpl();
        Data body = new Data(new Binary(value, offset,len));
        msg.setBody(body);
        return msg;
    }
View Full Code Here

      Object action = ((AmqpValue) msg.getBody()).getValue();
      if (action instanceof Declare)
      {
         Transaction tx = protonSession.getServerSession().getCurrentTransaction();
         Declared declared = new Declared();
         declared.setTxnId(new Binary(longToBytes(tx.getID())));
         delivery.disposition(declared);
         delivery.settle();
      }
      else if (action instanceof Discharge)
      {
View Full Code Here

      Object action = ((AmqpValue) msg.getBody()).getValue();
      if (action instanceof Declare)
      {
         Transaction tx = protonSession.getServerSession().getCurrentTransaction();
         Declared declared = new Declared();
         declared.setTxnId(new Binary(longToBytes(tx.getID())));
         delivery.disposition(declared);
         delivery.settle();
      }
      else if (action instanceof Discharge)
      {
View Full Code Here

            {
               message.getBodyBuffer().writeNullableString((String) value);
            }
            else if (value instanceof Binary)
            {
               Binary binary = (Binary) value;
               message.getBodyBuffer().writeBytes(binary.getArray());
            }
         }
         else if (section instanceof Data)
         {
            message.getBodyBuffer().writeBytes(((Data) section).getValue().getArray());
View Full Code Here

         {
            properties.setTo(message.getAddress().toString());
         }
         if (typedProperties.containsProperty(USER_ID_SS))
         {
            properties.setUserId(new Binary(typedProperties.getBytesProperty(USER_ID_SS)));
         }
         if (typedProperties.containsProperty(SUBJECT_SS))
         {
            properties.setSubject(typedProperties.getSimpleStringProperty(SUBJECT_SS).toString());
         }
View Full Code Here

         Integer type = message.getIntProperty(MESSAGE_TYPE);
         switch (type)
         {
            case 0:
            case 1:
               return new Data(new Binary(message.getBodyBuffer().copy().byteBuf().array()));
            case 2:
               return new AmqpValue(new Binary(message.getBodyBuffer().copy().byteBuf().array()));
            case 3:
               return new AmqpValue(message.getBodyBuffer().copy().readNullableString());
            default:
               return new Data(new Binary(message.getBodyBuffer().copy().byteBuf().array()));
         }
      }
View Full Code Here

        mng.start();
        Message msg = new MessageImpl();
        msg.setAddress(ADDRESS);
        msg.setSubject("hello");
        msg.setContentType("application/octet-stream");
        msg.setBody(new Data(new Binary("hello world".getBytes())));
        mng.put(msg);
        mng.send();

        mng.subscribe(ADDRESS);
        mng.recv();
View Full Code Here

TOP

Related Classes of org.apache.qpid.proton.amqp.Binary

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.