Package org.apache.qpid.framing.abstraction

Examples of org.apache.qpid.framing.abstraction.ContentChunk


        {
            throw new IllegalArgumentException("Index " + index + " out of valid range 0 to " +
                                               (_contentBodies.size() - 1));
        }
        WeakReference<ContentChunk> wr = _contentBodies.get(index);
        ContentChunk cb = wr.get();
        if (cb == null)
        {
            cb = _messageStore.getContentBodyChunk(context, messageId, index);
            _contentBodies.set(index, new WeakReference<ContentChunk>(cb));
        }
View Full Code Here


        // get message content
        Iterator<ContentChunk> cBodies = msg.getContentBodyIterator();
        List<Byte> msgContent = new ArrayList<Byte>();
        while (cBodies.hasNext())
        {
            ContentChunk body = cBodies.next();
            if (body.getSize() != 0)
            {
                if (body.getSize() != 0)
                {
                    ByteBuffer slice = body.getData().slice();
                    for (int j = 0; j < slice.limit(); j++)
                    {
                        msgContent.add(slice.get());
                    }
                }
View Full Code Here

            //
            // Optimise the case where we have a single content body. In that case we create a composite block
            // so that we can writeDeliver out the deliver, header and body with a single network writeDeliver.
            //
            ContentChunk cb = messageHandle.getContentChunk(storeContext,messageId, 0);

            AMQDataBlock firstContentBody = new AMQFrame(channelId, getProtocolSession().getMethodRegistry().getProtocolVersionMethodConverter().convertToBody(cb));
            AMQDataBlock[] blocks = new AMQDataBlock[]{deliver, contentHeader, firstContentBody};
            CompositeAMQDataBlock compositeBlock = new CompositeAMQDataBlock(blocks);
            writeFrame(compositeBlock);
View Full Code Here

            //
            // Optimise the case where we have a single content body. In that case we create a composite block
            // so that we can writeDeliver out the deliver, header and body with a single network writeDeliver.
            //
            ContentChunk cb = messageHandle.getContentChunk(storeContext,messageId, 0);

            AMQDataBlock firstContentBody = new AMQFrame(channelId, getProtocolSession().getMethodRegistry().getProtocolVersionMethodConverter().convertToBody(cb));
            AMQDataBlock[] blocks = new AMQDataBlock[]{deliver, contentHeader, firstContentBody};
            CompositeAMQDataBlock compositeBlock = new CompositeAMQDataBlock(blocks);
            writeFrame(compositeBlock);
View Full Code Here

                ascii.add("ASCII");
                ascii.add(Console.ROW_DIVIDER);

                while (bodies.hasNext())
                {
                    ContentChunk chunk = (ContentChunk) bodies.next();

                    //Duplicate so we don't destroy original data :)
                    ByteBuffer hexBuffer = chunk.getData().duplicate();

                    ByteBuffer charBuffer = hexBuffer.duplicate();

                    Hex hexencoder = new Hex();
View Full Code Here

            //
            // Optimise the case where we have a single content body. In that case we create a composite block
            // so that we can writeDeliver out the deliver, header and body with a single network writeDeliver.
            //
            ContentChunk cb = messageHandle.getContentChunk(storeContext,messageId, 0);

            AMQBody firstContentBody = PROTOCOL_METHOD_CONVERTER.convertToBody(cb);

            CompositeAMQBodyBlock compositeBlock = new CompositeAMQBodyBlock(channelId, deliverBody, contentHeaderBody, firstContentBody);
            writeFrame(compositeBlock);
View Full Code Here

            //
            // Optimise the case where we have a single content body. In that case we create a composite block
            // so that we can writeDeliver out the deliver, header and body with a single network writeDeliver.
            //
            ContentChunk cb = messageHandle.getContentChunk(storeContext,messageId, 0);

            AMQDataBlock firstContentBody = new AMQFrame(channelId, PROTOCOL_METHOD_CONVERTER.convertToBody(cb));
            AMQDataBlock[] blocks = new AMQDataBlock[]{deliver, contentHeader, firstContentBody};
            CompositeAMQDataBlock compositeBlock = new CompositeAMQDataBlock(blocks);
            writeFrame(compositeBlock);
View Full Code Here

        try
        {

            // returns true iff the message was delivered (i.e. if all data was
            // received
            final ContentChunk contentChunk =
                    _session.getMethodRegistry().getProtocolVersionMethodConverter().convertToContentChunk(contentBody);

            _currentMessage.addContentBodyFrame(contentChunk);

            deliverCurrentMessageIfComplete();
View Full Code Here

        }

        for (int i = 0; i < messageCount; i++)
        {
            ContentChunk contentChunk = new ContentChunk()
            {
                private byte[] _data = new byte[(int)size];

                public int getSize()
                {
                    return (int) size;
                }

                public byte[] getData()
                {
                    return _data;
                }

                public void reduceToFit()
                {
                }
            };

            messages[i].addContentBodyFrame(contentChunk);
            messages[i].getStoredMessage().addContent(0, ByteBuffer.wrap(contentChunk.getData()));

            getQueue().enqueue(new AMQMessage(messages[i].getStoredMessage()));
        }
    }
View Full Code Here

            // route header
            MessageMetaData mmd = currentMessage.headersReceived(System.currentTimeMillis());

            // Add the message to the store so we have something to test later
            currentMessage.setStoredMessage(getMessageStore().addMessage(mmd));
            ContentChunk chunk = getSession().getMethodRegistry()
                                               .getProtocolVersionMethodConverter()
                                               .convertToContentChunk(
                                               new ContentBody(new byte[(int) MESSAGE_SIZE]));
            currentMessage.addContentBodyFrame(chunk);
            currentMessage.getStoredMessage().addContent(0, ByteBuffer.wrap(chunk.getData()));

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

TOP

Related Classes of org.apache.qpid.framing.abstraction.ContentChunk

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.