Package org.apache.qpid.framing

Examples of org.apache.qpid.framing.ContentBody


        {
            return ((ContentChunk_0_9)contentChunk).toBody();
        }
        else
        {
            return new ContentBody(contentChunk.getData());
        }
    }
View Full Code Here


        }
    }

    public ContentChunk convertToContentChunk(AMQBody body)
    {
        final ContentBody contentBodyChunk = (ContentBody) body;

        return new ContentChunk_0_9(contentBodyChunk);

    }
View Full Code Here

    }

    public AMQBody convertToBody(byte[] data)
    {
        return new ContentBody(data);
    }
View Full Code Here

        if (frames.length == (offset + 1))
        {
            byte[] data = new byte[payload.remaining()];
            payload.get(data);
            frames[offset] = ContentBody.createAMQFrame(channelId, new ContentBody(data));
        }
        else
        {

            final long framePayloadMax = getSession().getAMQConnection().getMaximumFrameSize() - 1;
            long remaining = payload.remaining();
            for (int i = offset; i < frames.length; i++)
            {
                payload.position((int) framePayloadMax * (i - offset));
                int length = (remaining >= framePayloadMax) ? (int) framePayloadMax : (int) remaining;
                payload.limit(payload.position() + length);
                byte[] data = new byte[payload.remaining()];
                payload.get(data);

                frames[i] = ContentBody.createAMQFrame(channelId, new ContentBody(data));

                remaining -= length;
            }
        }

View Full Code Here

        List<ContentBody> body = new ArrayList<ContentBody>();
        MessageStore messageStore = new SkeletonMessageStore();
        // channel can be null since it is only used in ack processing which does not apply to this test
        TransactionalContext txContext = new NonTransactionalContext(messageStore, null,
                                                                     new LinkedList<RequiredDeliveryException>());
        body.add(new ContentBody());
        MessageHandleFactory factory = new MessageHandleFactory();
        for (int i = 0; i < count; i++)
        {
            // this routes and delivers the message
            AMQMessage msg = new AMQMessage(i, publish, txContext, header, queues, body, messageStore,
View Full Code Here

            data = ByteBuffer.allocate((int) contentHeader.bodySize); // XXX: Is cast a problem?
            final Iterator it = bodies.iterator();
            while (it.hasNext())
            {
                ContentBody cb = (ContentBody) it.next();
                final ByteBuffer payload = cb.payload;
                if(payload.isDirect() || payload.isReadOnly())
                {
                    data.put(payload);
                }
View Full Code Here

    private void createContentBodies(ByteBuffer payload, AMQFrame[] frames, int offset, int channelId)
    {

        if (frames.length == (offset + 1))
        {
            frames[offset] = ContentBody.createAMQFrame(channelId, new ContentBody(payload));
        }
        else
        {

            final long framePayloadMax = _session.getAMQConnection().getMaximumFrameSize() - 1;
            long remaining = payload.remaining();
            for (int i = offset; i < frames.length; i++)
            {
                payload.position((int) framePayloadMax * (i - offset));
                int length = (remaining >= framePayloadMax) ? (int) framePayloadMax : (int) remaining;
                payload.limit(payload.position() + length);
                frames[i] = ContentBody.createAMQFrame(channelId, new ContentBody(payload.slice()));

                remaining -= length;
            }
        }

View Full Code Here

            // Add the body so we have somthing to test later
            currentMessage.addContentBodyFrame(
                    _protocolSession.getMethodRegistry()
                                                       .getProtocolVersionMethodConverter()
                                                       .convertToContentChunk(
                                                       new ContentBody(ByteBuffer.allocate((int) MESSAGE_SIZE),
                                                                       MESSAGE_SIZE)));
            currentMessage.deliverToQueues();


        }
View Full Code Here

            data = ByteBuffer.allocate((int) contentHeader.bodySize); // XXX: Is cast a problem?
            final Iterator it = bodies.iterator();
            while (it.hasNext())
            {
                ContentBody cb = (ContentBody) it.next();
                final ByteBuffer payload = ByteBuffer.wrap(cb._payload);
                if(payload.isDirect() || payload.isReadOnly())
                {
                    data.put(payload);
                }
View Full Code Here

        if (frames.length == (offset + 1))
        {
            byte[] data = new byte[payload.remaining()];
            payload.get(data);
            frames[offset] = ContentBody.createAMQFrame(channelId, new ContentBody(data));
        }
        else
        {

            final long framePayloadMax = _session.getAMQConnection().getMaximumFrameSize() - 1;
            long remaining = payload.remaining();
            for (int i = offset; i < frames.length; i++)
            {
                payload.position((int) framePayloadMax * (i - offset));
                int length = (remaining >= framePayloadMax) ? (int) framePayloadMax : (int) remaining;
                payload.limit(payload.position() + length);
                byte[] data = new byte[payload.remaining()];
                payload.get(data);

                frames[i] = ContentBody.createAMQFrame(channelId, new ContentBody(data));

                remaining -= length;
            }
        }

View Full Code Here

TOP

Related Classes of org.apache.qpid.framing.ContentBody

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.