Examples of BBDecoder


Examples of org.apache.qpid.transport.codec.BBDecoder

            return new AmqpValue(map);

        }
        else if("amqp/map".equals(mimeType))
        {
            BBDecoder decoder = new BBDecoder();
            decoder.init(ByteBuffer.wrap(data));
            return new AmqpValue(decoder.readMap());

        }
        else if("amqp/list".equals(mimeType))
        {
            BBDecoder decoder = new BBDecoder();
            decoder.init(ByteBuffer.wrap(data));
            return new AmqpValue(decoder.readList());
        }
        else if("jms/stream-message".equals(mimeType))
        {
            TypedBytesContentReader reader = new TypedBytesContentReader(ByteBuffer.wrap(data));
View Full Code Here

Examples of org.apache.qpid.transport.codec.BBDecoder

    protected void populateMapFromData(ByteBuffer data) throws JMSException
    {
        if (data != null)
        {
            data.rewind();
            BBDecoder decoder = new BBDecoder();
            decoder.init(data);
            setMap(decoder.readMap());
        }
        else
        {
            getMap().clear();
        }
View Full Code Here

Examples of org.apache.qpid.transport.codec.BBDecoder

    }

    private void assemble(Frame frame, ByteBuffer segment)
    {
        BBDecoder dec = _decoder.get();
        dec.init(segment);

        int channel = frame.getChannel();
        Method command;

        switch (frame.getType())
        {
        case CONTROL:
            int controlType = dec.readUint16();
            Method control = Method.create(controlType);
            control.read(dec);
            emit(channel, control);
            break;
        case COMMAND:
            int commandType = dec.readUint16();
            // read in the session header, right now we don't use it
            int hdr = dec.readUint16();
            command = Method.create(commandType);
            command.setSync((0x0001 & hdr) != 0);
            command.read(dec);
            if (command.hasPayload() && !frame.isLastSegment())
            {
                setIncompleteCommand(channel, command);
            }
            else
            {
                emit(channel, command);
            }
            break;
        case HEADER:
            command = getIncompleteCommand(channel);
            List<Struct> structs = null;
            DeliveryProperties deliveryProps = null;
            MessageProperties messageProps = null;

            while (dec.hasRemaining())
            {
                Struct struct = dec.readStruct32();
                if(struct instanceof  DeliveryProperties && deliveryProps == null)
                {
                    deliveryProps = (DeliveryProperties) struct;
                }
                else if(struct instanceof MessageProperties && messageProps == null)
                {
                    messageProps = (MessageProperties) struct;
                }
                else
                {
                    if(structs == null)
                    {
                        structs = new ArrayList<Struct>(2);
                    }
                    structs.add(struct);
                }

            }
            command.setHeader(new Header(deliveryProps,messageProps,structs));

            if (frame.isLastSegment())
            {
                setIncompleteCommand(channel, null);
                emit(channel, command);
            }
            break;
        case BODY:
            command = getIncompleteCommand(channel);
            command.setBody(segment);
            setIncompleteCommand(channel, null);
            emit(channel, command);
            break;
        default:
            throw new IllegalStateException("unknown frame type: " + frame.getType());
        }

        dec.releaseBuffer();
    }
View Full Code Here

Examples of org.apache.qpid.transport.codec.BBDecoder

    protected void populateListFromData(ByteBuffer data) throws JMSException
    {
        if (data != null)
        {
            data.rewind();
            BBDecoder decoder = new BBDecoder();
            decoder.init(data);
            _list = decoder.readList();
        }
        else
        {
            _list.clear();
        }
View Full Code Here

Examples of org.apache.qpid.transport.codec.BBDecoder

   * @param expected the expected result.
   */
  private void assertEquals(Message message, byte [] expected) throws IOException
  {
    ByteBuffer messageContent = message.readData();
    BBDecoder decoder = new BBDecoder();
    decoder.init(messageContent);
    byte [] content = decoder.readReaminingBytes()
    assertTrue(Arrays.equals(content, expected));   
  }
View Full Code Here

Examples of org.apache.qpid.transport.codec.BBDecoder

        byte [] presenceBytes = {2};
       
        QpidProperty property = new QpidProperty();
       
        // We don't need a decoder so in order to be sure that it won't be invoked set it to null.
        BBDecoder nullDecoder = null;
       
        for (int i = 0; i < 8; i++)
        {
            // Property number 1 is declaring a value so skip it!
            if (i != 1)
View Full Code Here

Examples of org.apache.qpid.transport.codec.BBDecoder

        property.markAsOptional(2);
       
        ByteBuffer buffer = ByteBuffer.allocate(8);
        buffer.putLong(_44);
        buffer.rewind();
        BBDecoder decoder = new BBDecoder();
       
        decoder.init(buffer);
        assertEquals(_44,property.decodeValue(decoder, presenceBytes));
    }
View Full Code Here

Examples of org.apache.qpid.transport.codec.BBDecoder

            {
                buffer.putLong(expected);
            }
        }
        buffer.rewind();
        BBDecoder decoder = new BBDecoder();
       
        decoder.init(buffer);
        int index = 0;
        for (QpidProperty property : properties)
        {
            assertEquals(expectedResults[index++],property.decodeValue(decoder, presenceBytes));           
        }
View Full Code Here

Examples of org.apache.qpid.transport.codec.BBDecoder

     * @param instance the managed object instance.
     * @param rawData the incoming configuration data which contains new values for instance properties.
     */
    void updateEventInstanceWithData(QpidManagedEvent instance)
    {
        BBDecoder decoder = new BBDecoder();
        decoder.init(ByteBuffer.wrap(instance._rawEventData));

        for (QpidProperty property : _schemaOrderedArguments)
        {                 
            try {
                Object value = property.decodeValue(decoder);
View Full Code Here

Examples of org.apache.qpid.transport.codec.BBDecoder

     * @param parameters the parameters values.
     * @param encoder the encoder used for encoding.
     */
    public Map<String, Object> decodeParameters (byte [] values)
    {
        BBDecoder decoder = new BBDecoder();
        decoder.init(ByteBuffer.wrap(values));
        Map<String, Object> result = new HashMap<String, Object>();
       
        for (QpidArgument argument : arguments)
        {
            if (argument.getDirection() != Direction.I)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.