@Override public int read() throws IOException { try { return this.message.readByte(); } catch (JMSException e) { throw new IOException(e.toString()); } }
msg.writeByte(bytesMsg.readByte());
@Override public byte readByte() throws JMSException { return message.readByte(); }
public byte readByte() throws JMSException { return ((BytesMessage) message).readByte(); }
public byte readByte() throws JMSException { return ((BytesMessage) message).readByte(); }
/** @see java.io.InputStream#read() */ @Override public int read() throws IOException { try { return delegate.readByte(); } catch (JMSException e) { throw new IOException(e); } }
/** @see java.io.InputStream#read() */ @Override public int read() throws IOException { try { return delegate.readByte(); } catch (JMSException e) { throw new IOException(e); } }
/** * Read * @return The value * @exception JMSException Thrown if an error occurs */ public byte readByte() throws JMSException { if (_log.isTraceEnabled()) { _log.trace("readByte()"); } return ((BytesMessage)_message).readByte(); }
public int read() throws IOException { try { return _message.readByte(); } catch (JMSException e) { throw new IOException(e.toString()); } }
@Override public int read() throws JMSExceptionWrapper { try { return message.readByte() & 0xFF; } catch (MessageEOFException ex) { return -1; } catch (JMSException ex) { throw new JMSExceptionWrapper(ex); } }
@Override public int read() throws IOException { try { return message.readByte(); } catch (MessageEOFException ex) { return -1; } catch (JMSException ex) { throw new JmsTransportException(ex); } } }
@Override public int read() throws JMSExceptionWrapper { try { return message.readByte() & 0xFF; } catch (MessageEOFException ex) { return -1; } catch (JMSException ex) { throw new JMSExceptionWrapper(ex); } }
@Override public int read() throws IOException { try { return this.message.readByte(); } catch (JMSException e) { throw new IOException(e.toString()); } }
@Override public int read() throws IOException { try { return message.readByte(); } catch (MessageEOFException ex) { return -1; } catch (JMSException ex) { throw new JmsTransportException(ex); } } }
@Override public int read() throws IOException { try { return message.readByte(); } catch (MessageEOFException ex) { return -1; } catch (JMSException ex) { throw new JmsTransportException(ex); } } }
/** * Read * * @return The value * @throws JMSException Thrown if an error occurs */ @Override public byte readByte() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("readByte()"); } return ((BytesMessage) message).readByte(); }
/** * Read * * @return The value * @throws JMSException Thrown if an error occurs */ @Override public byte readByte() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("readByte()"); } return ((BytesMessage) message).readByte(); }
@Test public void testSendMessageWithContentLength() throws Exception { MessageConsumer consumer = session.createConsumer(queue); conn.connect(defUser, defPass); byte[] data = new byte[]{1, 0, 0, 4}; ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write(data); baos.flush(); ClientStompFrame frame = conn.createFrame(Stomp.Commands.SEND) .addHeader(Stomp.Headers.Send.DESTINATION, getQueuePrefix() + getQueueName()) .addHeader(Stomp.Headers.CONTENT_LENGTH, Integer.toString(data.length)) .setBody(new String(baos.toByteArray())); conn.sendFrame(frame); BytesMessage message = (BytesMessage) consumer.receive(10000); Assert.assertNotNull(message); assertEquals(data.length, message.getBodyLength()); assertEquals(data[0], message.readByte()); assertEquals(data[1], message.readByte()); assertEquals(data[2], message.readByte()); assertEquals(data[3], message.readByte()); }
@Test public void testReceiveBytes() throws Exception { JMSProducer producer = context.createProducer(); JMSConsumer consumer = context.createConsumer(queue1); BytesMessage bytesSend = context.createBytesMessage(); bytesSend.writeByte((byte) 1); bytesSend.writeLong(2L); producer.send(queue1, bytesSend); BytesMessage msgReceived = (BytesMessage) consumer.receiveNoWait(); byte[] bytesArray = msgReceived.getBody(byte[].class); assertEquals((byte) 1, msgReceived.readByte()); assertEquals(2L, msgReceived.readLong()); DataInputStream dataInputStream = new DataInputStream(new ByteArrayInputStream(bytesArray)); assertEquals((byte) 1, dataInputStream.readByte()); assertEquals(2L, dataInputStream.readLong()); }
@Test public void bytesMessage() throws Exception { context = cf.createContext(); try { JMSProducer producer = context.createProducer(); BytesMessage bMsg = context.createBytesMessage(); bMsg.setStringProperty("COM_SUN_JMS_TESTNAME", "sendAndRecvMsgOfEachTypeCLTest"); bMsg.writeByte((byte) 1); bMsg.writeInt(22); CountDownLatch latch = new CountDownLatch(1); SimpleCompletionListener listener = new SimpleCompletionListener(latch); producer.setAsync(listener); producer.send(queue1, bMsg); assertTrue(latch.await(5, TimeUnit.SECONDS)); assertEquals(listener.message.readByte(), (byte) 1); assertEquals(listener.message.readInt(), 22); } finally { context.close(); } }