Examples of BBEncoder


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

        return buf.limit();
    }

    private ByteBuffer encodeAsBuffer()
    {
        BBEncoder encoder = new BBEncoder(ENCODER_SIZE);

        encoder.writeInt64(_arrivalTime);
        encoder.writeInt32(_bodySize);
        int headersLength = 0;
        if(_header.getDeliveryProperties() != null)
        {
            headersLength++;
        }
        if(_header.getMessageProperties() != null)
        {
            headersLength++;
        }
        if(_header.getNonStandardProperties() != null)
        {
            headersLength += _header.getNonStandardProperties().size();
        }

        encoder.writeInt32(headersLength);

        if(_header.getDeliveryProperties() != null)
        {
            encoder.writeStruct32(_header.getDeliveryProperties());
        }
        if(_header.getMessageProperties() != null)
        {
            encoder.writeStruct32(_header.getMessageProperties());
        }
        if(_header.getNonStandardProperties() != null)
        {

            for(Struct header : _header.getNonStandardProperties())
            {
                encoder.writeStruct32(header);
            }

        }
        ByteBuffer buf = encoder.buffer();
        return buf;
    }
View Full Code Here

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

        {
            throw new MessageFormatException("Attempting to do AMQPMessage.setList() on null Message");
        }
        else if (message instanceof BytesMessage)
        {
            BBEncoder encoder = new BBEncoder(1024);
            encoder.writeList(list);
            ByteBuffer buf = encoder.segment();
            byte[] data = new byte[buf.limit()];
            buf.get(data);
            ((BytesMessage)message).writeBytes(data);
        }
        else
View Full Code Here

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


    public QMFMessage(String routingKey, QMFCommand[] commands)
    {
        _routingKey = routingKey;
        BBEncoder encoder = new BBEncoder(256);

        for(QMFCommand cmd : commands)
        {
            cmd.encode(encoder);
        }


        _content = encoder.buffer();
    }
View Full Code Here

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

        return buf.limit();
    }

    private ByteBuffer encodeAsBuffer()
    {
        BBEncoder encoder = new BBEncoder(ENCODER_SIZE);

        encoder.writeInt64(_arrivalTime);
        encoder.writeInt32(_bodySize);
        Struct[] headers = _header == null ? new Struct[0] : _header.getStructs();
        encoder.writeInt32(headers.length);


        for(Struct header : headers)
        {
            encoder.writeStruct32(header);

        }

        ByteBuffer buf = encoder.buffer();
        return buf;
    }
View Full Code Here

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

    }

    @ Override
    protected void writeMapToData()
    {
        BBEncoder encoder = new BBEncoder(1024);
        encoder.writeMap(_map);
        _data = ByteBuffer.wrap(encoder.segment());
    }
View Full Code Here

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

        return buf.limit();
    }

    private ByteBuffer encodeAsBuffer()
    {
        BBEncoder encoder = new BBEncoder(ENCODER_SIZE);

        encoder.writeInt64(_arrivalTime);
        encoder.writeInt32(_bodySize);
        int headersLength = 0;
        if(_header.getDeliveryProperties() != null)
        {
            headersLength++;
        }
        if(_header.getMessageProperties() != null)
        {
            headersLength++;
        }
        if(_header.getNonStandardProperties() != null)
        {
            headersLength += _header.getNonStandardProperties().size();
        }

        encoder.writeInt32(headersLength);

        if(_header.getDeliveryProperties() != null)
        {
            encoder.writeStruct32(_header.getDeliveryProperties());
        }
        if(_header.getMessageProperties() != null)
        {
            encoder.writeStruct32(_header.getMessageProperties());
        }
        if(_header.getNonStandardProperties() != null)
        {

            for(Struct header : _header.getNonStandardProperties())
            {
                encoder.writeStruct32(header);
            }

        }
        ByteBuffer buf = encoder.buffer();
        return buf;
    }
View Full Code Here

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

        return buf;
    }

    private void method(Method method, SegmentType type)
    {
        BBEncoder enc = encoder.get();
        enc.init();
        enc.writeUint16(method.getEncodedType());
        if (type == SegmentType.COMMAND)
        {
            if (method.isSync())
            {
                enc.writeUint16(0x0101);
            }
            else
            {
                enc.writeUint16(0x0100);
            }
        }
        method.write(enc);
        ByteBuffer methodSeg = enc.segment();

        byte flags = FIRST_SEG;

        boolean payload = method.hasPayload();
        if (!payload)
        {
            flags |= LAST_SEG;
        }

        ByteBuffer headerSeg = null;
        if (payload)
        {
            final Header hdr = method.getHeader();
            final Struct[] structs = hdr.getStructs();

            for (Struct st : structs)
            {
                enc.writeStruct32(st);
            }
            headerSeg = enc.segment();
        }

        synchronized (sendlock)
        {
            fragment(flags, type, method, methodSeg);
View Full Code Here

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


    public QMFMessage(String routingKey, QMFCommand[] commands)
    {
        _routingKey = routingKey;
        BBEncoder encoder = new BBEncoder(256);

        for(QMFCommand cmd : commands)
        {
            cmd.encode(encoder);
        }


        _content = encoder.buffer();
    }
View Full Code Here

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

        return buf.limit();
    }

    private ByteBuffer encodeAsBuffer()
    {
        BBEncoder encoder = new BBEncoder(ENCODER_SIZE);

        encoder.writeInt64(_arrivalTime);
        encoder.writeInt32(_bodySize);
        Struct[] headers = _header == null ? new Struct[0] : _header.getStructs();
        encoder.writeInt32(headers.length);


        for(Struct header : headers)
        {
            encoder.writeStruct32(header);

        }

        ByteBuffer buf = encoder.buffer();
        return buf;
    }
View Full Code Here

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

        method(method, SegmentType.COMMAND);
    }

    private void method(Method method, SegmentType type)
    {
        BBEncoder enc = _encoder.get();
        enc.init();
        enc.writeUint16(method.getEncodedType());
        if (type == SegmentType.COMMAND)
        {
            if (method.isSync())
            {
                enc.writeUint16(0x0101);
            }
            else
            {
                enc.writeUint16(0x0100);
            }
        }
        method.write(enc);
        ByteBuffer methodSeg = enc.segment();

        byte flags = FIRST_SEG;

        boolean payload = method.hasPayload();
        if (!payload)
        {
            flags |= LAST_SEG;
        }

        ByteBuffer headerSeg = null;
        if (payload)
        {
            final Header hdr = method.getHeader();
            if (hdr != null)
            {
                final Struct[] structs = hdr.getStructs();

                for (Struct st : structs)
                {
                    enc.writeStruct32(st);
                }
            }
            headerSeg = enc.segment();
        }

        synchronized (sendlock)
        {
            fragment(flags, type, method, methodSeg);
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.