Package org.apache.qpid.framing

Examples of org.apache.qpid.framing.ContentBody


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

            AMQMessage m = new AMQMessage(currentMessage.getStoredMessage());
            for(BaseQueue q : currentMessage.getDestinationQueues())
            {
View Full Code Here


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

        if (compressBufferOnQueue)
        {
            Iterator it = msg.getContentBodies().iterator();
            while (it.hasNext())
            {
                ContentBody cb = (ContentBody) it.next();
                cb.reduceBufferToFit();
            }
        }

        _messages.offer(msg);
View Full Code Here

        BasicPublishBody publish = new BasicPublishBody();
        publish.exchange = new NullExchange().getName();
        ContentHeaderBody header = new ContentHeaderBody();
        List<ContentBody> body = new ArrayList<ContentBody>();
        MessageStore messageStore = new SkeletonMessageStore();
        body.add(new ContentBody());
        for (int i = 0; i < count; i++)
        {
            for (AMQQueue q : queues)
            {
                q.deliver(new AMQMessage(messageStore, i, publish, header, body));
View Full Code Here

            _logger.debug("Fragmented message body (" + bodies.size() + " frames, bodySize=" + contentHeader.bodySize + ")");
            data = ByteBuffer.allocate((int)contentHeader.bodySize); // XXX: Is cast a problem?
            final Iterator it = bodies.iterator();
            while (it.hasNext())
            {
                ContentBody cb = (ContentBody) it.next();
                data.put(cb.payload);
                cb.payload.release();
            }
            data.flip();
        }
View Full Code Here

                    if(bodyCount > 0)
                    {
                        long bodyLengthReceived = 0;
                        for(int i = 0 ; i < bodyCount ; i++)
                        {
                            ContentBody contentChunk = _currentMessage.getContentChunk(i);
                            handle.addContent((int)bodyLengthReceived, ByteBuffer.wrap(contentChunk.getPayload()));
                            bodyLengthReceived += contentChunk.getSize();
                        }
                    }

                    if(!checkMessageUserId(_currentMessage.getContentHeader()))
                    {
View Full Code Here

                data = ByteBuffer.allocate((int) contentHeader.getBodySize()); // XXX: Is cast a problem?
                final Iterator it = bodies.iterator();
                while (it.hasNext())
                {
                    ContentBody cb = (ContentBody) it.next();
                    final ByteBuffer payload = ByteBuffer.wrap(cb.getPayload());
                    if (payload.isDirect() || payload.isReadOnly())
                    {
                        data.put(payload);
                    }
                    else
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

                    if(bodyCount > 0)
                    {
                        long bodyLengthReceived = 0;
                        for(int i = 0 ; i < bodyCount ; i++)
                        {
                            ContentBody contentChunk = _currentMessage.getContentChunk(i);
                            handle.addContent((int)bodyLengthReceived, ByteBuffer.wrap(contentChunk.getPayload()));
                            bodyLengthReceived += contentChunk.getSize();
                        }
                    }

                    if(!checkMessageUserId(_currentMessage.getContentHeader()))
                    {
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

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.