Package org.apache.activemq.command

Examples of org.apache.activemq.command.ActiveMQBytesMessage.readBytes()


            }
        } else if (message.getDataStructureType() == ActiveMQBytesMessage.DATA_STRUCTURE_TYPE) {
            ActiveMQBytesMessage msg = (ActiveMQBytesMessage) message.copy();
            msg.setReadOnlyBody(true);
            byte[] data = new byte[(int) msg.getBodyLength()];
            msg.readBytes(data);
            result.payload(new Buffer(data));
        } else if (message.getDataStructureType() == ActiveMQMapMessage.DATA_STRUCTURE_TYPE) {
            ActiveMQMapMessage msg = (ActiveMQMapMessage) message.copy();
            msg.setReadOnlyBody(true);
            Map<String, Object> map = msg.getContentMap();
View Full Code Here


        ActiveMQBytesMessage message = (ActiveMQBytesMessage) msg;
        assertTrue(message.isCompressed());
        assertTrue(message.getContent().getLength() < bytes.length);

        byte[] result = new byte[bytes.length];
        assertEquals(bytes.length, message.readBytes(result));
        assertEquals(-1, message.readBytes(result));

        for(int i = 0; i < bytes.length; ++i) {
            assertEquals(bytes[i], result[i]);
        }
View Full Code Here

        assertTrue(message.isCompressed());
        assertTrue(message.getContent().getLength() < bytes.length);

        byte[] result = new byte[bytes.length];
        assertEquals(bytes.length, message.readBytes(result));
        assertEquals(-1, message.readBytes(result));

        for(int i = 0; i < bytes.length; ++i) {
            assertEquals(bytes[i], result[i]);
        }
    }
View Full Code Here

                    }

                    // Read the buffer in.
                    ActiveMQBytesMessage bm = (ActiveMQBytesMessage)m;
                    buffer = new byte[(int)bm.getBodyLength()];
                    bm.readBytes(buffer);
                    pos = 0;
                    if (jmsProperties == null) {
                        jmsProperties = Collections.unmodifiableMap(new HashMap<String, Object>(bm.getProperties()));
                    }
                } else {
View Full Code Here

            } catch (JMSException e) {
                rc.put(CompositeDataConstants.BODY_LENGTH, Long.valueOf(0));
            }
            try {
                byte preview[] = new byte[(int)Math.min(length, 255)];
                m.readBytes(preview);
                m.reset();

                // This is whack! Java 1.5 JMX spec does not support primitive
                // arrays!
                // In 1.6 it seems it is supported.. but until then...
View Full Code Here

        } else if (message.getDataStructureType() == ActiveMQBytesMessage.DATA_STRUCTURE_TYPE) {

            ActiveMQBytesMessage msg = (ActiveMQBytesMessage)message.copy();
            msg.setReadOnlyBody(true);
            byte[] data = new byte[(int)msg.getBodyLength()];
            msg.readBytes(data);

            headers.put(Stomp.Headers.CONTENT_LENGTH, Integer.toString(data.length));
            command.setContent(data);
        } else if (message.getDataStructureType() == ActiveMQMessage.DATA_STRUCTURE_TYPE &&
                AdvisorySupport.ADIVSORY_MESSAGE_TYPE.equals(message.getType())) {
View Full Code Here

            }
        } else if (message.getDataStructureType() == ActiveMQBytesMessage.DATA_STRUCTURE_TYPE) {
            ActiveMQBytesMessage msg = (ActiveMQBytesMessage) message.copy();
            msg.setReadOnlyBody(true);
            byte[] data = new byte[(int) msg.getBodyLength()];
            msg.readBytes(data);
            result.payload(new Buffer(data));
        } else if (message.getDataStructureType() == ActiveMQMapMessage.DATA_STRUCTURE_TYPE) {
            ActiveMQMapMessage msg = (ActiveMQMapMessage) message.copy();
            msg.setReadOnlyBody(true);
            Map<String, Object> map = msg.getContentMap();
View Full Code Here

            }
        } else if (message.getDataStructureType() == ActiveMQBytesMessage.DATA_STRUCTURE_TYPE) {
            ActiveMQBytesMessage msg = (ActiveMQBytesMessage) message.copy();
            msg.setReadOnlyBody(true);
            byte[] data = new byte[(int) msg.getBodyLength()];
            msg.readBytes(data);
            result.payload(new Buffer(data));
        } else if (message.getDataStructureType() == ActiveMQMapMessage.DATA_STRUCTURE_TYPE) {
            ActiveMQMapMessage msg = (ActiveMQMapMessage) message.copy();
            msg.setReadOnlyBody(true);
            Map<String, Object> map = msg.getContentMap();
View Full Code Here

        } else if (message.getDataStructureType() == ActiveMQBytesMessage.DATA_STRUCTURE_TYPE) {

            ActiveMQBytesMessage msg = (ActiveMQBytesMessage)message.copy();
            msg.setReadOnlyBody(true);
            byte[] data = new byte[(int)msg.getBodyLength()];
            msg.readBytes(data);

            headers.put(Stomp.Headers.CONTENT_LENGTH, "" + data.length);
            command.setContent(data);
        }
        return command;
View Full Code Here

        ActiveMQBytesMessage message = (ActiveMQBytesMessage) msg;
        assertTrue(message.isCompressed());
        assertTrue(message.getContent().getLength() < bytes.length);

        byte[] result = new byte[bytes.length];
        assertEquals(bytes.length, message.readBytes(result));
        assertEquals(-1, message.readBytes(result));

        for(int i = 0; i < bytes.length; ++i) {
            assertEquals(bytes[i], result[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.