Package javax.jms

Examples of javax.jms.BytesMessage.readBytes()


            String text = ((TextMessage)m).getText();
            return evaluate(text);
        } else if (m instanceof BytesMessage) {
            BytesMessage bm = (BytesMessage)m;
            byte data[] = new byte[(int)bm.getBodyLength()];
            bm.readBytes(data);
            return evaluate(data);
        }
        return false;
    }
View Full Code Here


            String text = ((TextMessage)message).getText();
            return evaluate(text);
        } else if (message instanceof BytesMessage) {
            BytesMessage bm = (BytesMessage)message;
            byte data[] = new byte[(int)bm.getBodyLength()];
            bm.readBytes(data);
            return evaluate(data);
        }
        return false;
    }
View Full Code Here

        if (message instanceof BytesMessage) {
            BytesMessage msg = (BytesMessage) message;
            int len = (int) msg.getBodyLength();
            if (len > -1) {
                byte[] data = new byte[len];
                msg.readBytes(data);
                return new String(data);
            } else {
                return "";
            }
        }
View Full Code Here

                return message;
            }

            public void completeCheck(BytesMessage message) throws JMSException {
                byte[] result = new byte[bytes.length];
                message.readBytes(result);
                Assert.assertArrayEquals("The returned byte array was different", bytes, result);
            }
        });
    }
View Full Code Here

        for (Object m : received)
        {
            final BytesMessage bytesMessage = (BytesMessage) m;
            final long bodyLength = bytesMessage.getBodyLength();
            byte[] data = new byte[(int) bodyLength];
            bytesMessage.readBytes(data);
            FieldTable actual = FieldTableFactory.newFieldTable(new DataInputStream(new ByteArrayInputStream(data)), bodyLength);
            for (String key : _expected.keys())
            {
                assertEquals("Values for " + key + " did not match", _expected.getObject(key), actual.getObject(key));
            }
View Full Code Here

        }
        if (message instanceof BytesMessage) {
            final BytesMessage bmsg = (BytesMessage)message;
            final int len = (int)bmsg.getBodyLength();
            final byte[] data = new byte[len];
            bmsg.readBytes(data,len);
            return NIOConverter.toByteBuffer(data);
           
        }
        if (message instanceof StreamMessage) {
            final StreamMessage msg = (StreamMessage)message;
View Full Code Here

        for (Object m : received)
        {
            final BytesMessage bytesMessage = (BytesMessage) m;
            final long bodyLength = bytesMessage.getBodyLength();
            byte[] data = new byte[(int) bodyLength];
            bytesMessage.readBytes(data);
            FieldTable actual = FieldTableFactory.newFieldTable(new DataInputStream(new ByteArrayInputStream(data)), bodyLength);
            for (String key : _expected.keys())
            {
                assertEquals("Values for " + key + " did not match", _expected.getObject(key), actual.getObject(key));
            }
View Full Code Here

        byte[] body = new byte[1024];
        int size = 0;
        int n;
        try
        {
            while ((n = msg.readBytes(buf)) > 0)
            {
                body = ensure(size + n, body, size);
                System.arraycopy(buf, 0, body, size, n);
                size += n;
            }
View Full Code Here

               BytesMessage bmsg = (BytesMessage)tm;
               msgs.add(tm.getStringProperty("msg"));
               byte buffRead[] = new byte[1024];
               for (int i = 0; i < 1024; i++)
               {
                  Assert.assertEquals(1024, bmsg.readBytes(buffRead));
               }
            }
            else
            {
               msgs.add(((TextMessage)tm).getText());
View Full Code Here

               BytesMessage bmsg = (BytesMessage)tm;
               Assert.assertEquals("message" + (i + start), tm.getStringProperty("msg"));
               byte buffRead[] = new byte[1024];
               for (int j = 0; j < 1024; j++)
               {
                  Assert.assertEquals(1024, bmsg.readBytes(buffRead));
               }
            }
            else
            {
               Assert.assertEquals("message" + (i + start), ((TextMessage)tm).getText());
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.