Examples of BytesMessageImpl


Examples of com.caucho.jms.message.BytesMessageImpl

   * Reads a bytes message.
   */
  private BytesMessageImpl readBytesMessage(InputStream is)
    throws IOException, JMSException
  {
    BytesMessageImpl bytes = new BytesMessageImpl();

    if (is == null) {
      bytes.reset();
     
      return bytes;
    }

    int data;

    while ((data = is.read()) >= 0) {
      bytes.writeByte((byte) data);
    }

    bytes.reset();
   
    return bytes;
  }
View Full Code Here

Examples of com.caucho.jms.message.BytesMessageImpl

  public BytesMessage createBytesMessage()
    throws JMSException
  {
    checkOpen();
   
    return new BytesMessageImpl();
  }
View Full Code Here

Examples of com.caucho.jms.message.BytesMessageImpl

  public BytesMessage createBytesMessage()
    throws JMSException
  {
    checkOpen();
   
    return new BytesMessageImpl();
  }
View Full Code Here

Examples of com.caucho.jms.message.BytesMessageImpl

   * Reads a bytes message.
   */
  private BytesMessageImpl readBytesMessage(InputStream is)
    throws IOException, JMSException
  {
    BytesMessageImpl bytes = new BytesMessageImpl();

    if (is == null) {
      bytes.reset();
     
      return bytes;
    }

    int data;

    while ((data = is.read()) >= 0) {
      bytes.writeByte((byte) data);
    }

    bytes.reset();
   
    return bytes;
  }
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.BytesMessageImpl

        return msg;
    }
   
    public static BytesMessageImpl createBytesMessage( int size ) throws JMSException
    {
        BytesMessageImpl msg = new BytesMessageImpl();
        setDummyProperties(msg);
       
        msg.writeBoolean(true);
        msg.writeUTF("foobar");
        msg.writeChar('c');
        msg.writeByte((byte)1);
        msg.writeShort((short)2);
        msg.writeInt(3);
        msg.writeLong(4);
        msg.writeFloat(1.23f);
        msg.writeDouble(4.56);
        msg.writeBytes(createDummyByteArray(size));
       
        return msg;
    }
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.BytesMessageImpl

    /* (non-Javadoc)
     * @see javax.jms.Session#createBytesMessage()
     */
    public final BytesMessage createBytesMessage() throws JMSException
    {
        return new BytesMessageImpl();
    }
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.BytesMessageImpl

*/
public class BytesMessageImplTest extends TestCase
{
  public void testWriteNull() throws Exception
  {
    BytesMessageImpl msg;
   
    msg = new BytesMessageImpl();
   
    try { msg.writeBytes(null); } catch (NullPointerException e) { /* OK */ }
    try { msg.writeBytes(null, 0, 0); } catch (NullPointerException e) { /* OK */ }
    try { msg.writeObject(null); } catch (NullPointerException e) { /* OK */ }
    try { msg.writeUTF(null); } catch (NullPointerException e) { /* OK */ }
  }
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.BytesMessageImpl

    try { msg.writeUTF(null); } catch (NullPointerException e) { /* OK */ }
  }
 
  public void testRollback() throws Exception
  {
    BytesMessageImpl msg;
   
    byte[] dummy = { (byte)1 , (byte)2 , (byte)3 };
   
    // Boolean
    msg = new BytesMessageImpl();
    msg.writeBytes(dummy);
    msg.reset();
    assertEquals(true,msg.readBoolean());
   
    // Byte
    msg = new BytesMessageImpl();
    msg.writeBytes(dummy);
    msg.reset();
    assertEquals(1,msg.readByte());
   
    // Short
    msg = new BytesMessageImpl();
    msg.writeBytes(dummy);
    msg.reset();
    assertEquals(2+1*256,msg.readShort());
   
    // Char
    msg = new BytesMessageImpl();
    msg.writeBytes(dummy);
    msg.reset();
    assertEquals(3,msg.readBytes(new byte[3]));
   
    // Int
    msg = new BytesMessageImpl();
    msg.writeBytes(dummy);
    msg.reset();
    try { msg.readInt(); fail("Should have failed"); } catch (MessageEOFException e) { /* OK */ }
    assertEquals(3,msg.readBytes(new byte[3]));
   
    // Long
    msg = new BytesMessageImpl();
    msg.writeBytes(dummy);
    msg.reset();
    try { msg.readLong(); fail("Should have failed"); } catch (MessageEOFException e) { /* OK */ }
    assertEquals(3,msg.readBytes(new byte[3]));
   
    // Float
    msg = new BytesMessageImpl();
    msg.writeBytes(dummy);
    msg.reset();
    try { msg.readFloat(); fail("Should have failed"); } catch (MessageEOFException e) { /* OK */ }
    assertEquals(3,msg.readBytes(new byte[3]));
   
    // Double
    msg = new BytesMessageImpl();
    msg.writeBytes(dummy);
    msg.reset();
    try { msg.readDouble(); fail("Should have failed"); } catch (MessageEOFException e) { /* OK */ }
    assertEquals(3,msg.readBytes(new byte[3]));
   
    // String
    msg = new BytesMessageImpl();
    msg.writeBytes(dummy);
    msg.reset();
    try { msg.readUTF(); fail("Should have failed"); } catch (MessageEOFException e) { /* OK */ }
    assertEquals(3,msg.readBytes(new byte[3]));
   
    // Bytes
    msg = new BytesMessageImpl();
    msg.writeBytes(dummy);
    msg.reset();
    byte[] data = new byte[3];
    assertEquals(3,msg.readBytes(data));
    System.out.println(data[0]);
    assertEquals(1, data[0]);
    assertEquals(2, data[1]);
    assertEquals(3, data[2]);
   
    assertEquals(10, msg.getBodyLength());
  }
View Full Code Here

Examples of org.exolab.jms.message.BytesMessageImpl

     * @throws JMSException if the JMS provider fails to create this message due
     *                      to some internal error.
     */
    public BytesMessage createBytesMessage() throws JMSException {
        ensureOpen();
        return new BytesMessageImpl();
    }
View Full Code Here

Examples of org.exolab.jms.message.BytesMessageImpl

     *
     * @return a new message
     * @throws JMSException for any JMS error
     */
    protected Message newMessage() throws JMSException {
        return new BytesMessageImpl();
    }
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.