Package org.apache.activemq.command

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


                data[i] = (byte) i;
            }
            msg.writeBytes(data);
            msg.reset();
            byte[] test = new byte[data.length];
            msg.readBytes(test);
            for (int i = 0; i < test.length; i++) {
                assertTrue(test[i] == i);
            }
        } catch (JMSException jmsEx) {
            jmsEx.printStackTrace();
View Full Code Here


        message.reset();
        try {
            message.readBoolean();
            message.readByte();
            message.readUnsignedByte();
            message.readBytes(new byte[1]);
            message.readBytes(new byte[2], 2);
            message.readChar();
            message.readDouble();
            message.readFloat();
            message.readInt();
View Full Code Here

        try {
            message.readBoolean();
            message.readByte();
            message.readUnsignedByte();
            message.readBytes(new byte[1]);
            message.readBytes(new byte[2], 2);
            message.readChar();
            message.readDouble();
            message.readFloat();
            message.readInt();
            message.readLong();
View Full Code Here

            message.readUnsignedByte();
            fail("Should have thrown exception");
        } catch (MessageNotReadableException e) {
        }
        try {
            message.readBytes(new byte[1]);
            fail("Should have thrown exception");
        } catch (MessageNotReadableException e) {
        }
        try {
            message.readBytes(new byte[2], 2);
View Full Code Here

            message.readBytes(new byte[1]);
            fail("Should have thrown exception");
        } catch (MessageNotReadableException e) {
        }
        try {
            message.readBytes(new byte[2], 2);
            fail("Should have thrown exception");
        } catch (MessageNotReadableException e) {
        }
        try {
            message.readChar();
View Full Code Here

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

                // This is whack! Java 1.5 JMX spec does not support primitive
                // arrays!
                // In 1.6 it seems it is supported.. but until then...
                Byte data[] = new Byte[preview.length];
View Full Code Here

                    }
                   
                    // Read the buffer in.
                    ActiveMQBytesMessage bm = (ActiveMQBytesMessage) m;
                    buffer = new byte[(int) bm.getBodyLength()];
                    bm.readBytes(buffer);
                    pos=0;                   
                } else {
                    eosReached=true;
                }
                return;
View Full Code Here

                    }

                    // Read the buffer in.
                    ActiveMQBytesMessage bm = (ActiveMQBytesMessage)m;
                    buffer = new byte[(int)bm.getBodyLength()];
                    bm.readBytes(buffer);
                    pos = 0;
                } else {
                    eosReached = true;
                }
                return;
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

        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.