org.objectweb.joram.client.jms
Class StreamMessage

java.lang.Object
  extended by org.objectweb.joram.client.jms.Message
      extended by org.objectweb.joram.client.jms.StreamMessage
All Implemented Interfaces:
javax.jms.Message, javax.jms.StreamMessage

public final class StreamMessage
extends Message
implements javax.jms.StreamMessage

Implements the javax.jms.StreamMessage interface.


Field Summary
private  int available
           
private static int BOOLEAN
           
private static int BYTE
           
private static int BYTES
           
private static int CHAR
           
private static int DOUBLE
           
private  boolean firstTimeBytesRead
           
private static int FLOAT
           
private  java.io.DataInputStream inputStream
          The stream for reading the data.
private static int INT
           
private static int LONG
           
private static int NULL
           
private  java.io.ByteArrayOutputStream outputBuffer
          The array in which the written data is buffered.
private  java.io.DataOutputStream outputStream
          The stream in which body data is written.
private  boolean prepared
          true if the message has been sent since its last modification.
private static int SHORT
           
private static int STRING
           
 
Fields inherited from class org.objectweb.joram.client.jms.Message
jmsDest, logger, momMsg, propertiesRO, RObody, session
 
Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
 
Constructor Summary
StreamMessage()
          Instantiates a bright new StreamMessage.
StreamMessage(Session session, Message momMsg)
          Instantiates a StreamMessage wrapping a consumed MOM message containing a stream of bytes.
 
Method Summary
 void clearBody()
          API method.
protected  void prepare()
          Method actually preparing the message for sending by transferring the local body into the wrapped MOM message.
private  void prepareWrite()
          Internal method called before each writing operation.
 boolean readBoolean()
          API method.
 byte readByte()
          API method.
 int readBytes(byte[] bytes)
          API method.
 char readChar()
          API method.
 double readDouble()
          API method.
 float readFloat()
          API method.
 int readInt()
          API method.
 long readLong()
          API method.
 java.lang.Object readObject()
          API method.
 short readShort()
          API method.
 java.lang.String readString()
          API method.
 void reset()
          API method.
 void writeBoolean(boolean value)
          API method.
 void writeByte(byte value)
          API method.
 void writeBytes(byte[] value)
          API method.
 void writeBytes(byte[] value, int offset, int length)
          API method.
 void writeChar(char value)
          API method.
 void writeDouble(double value)
          API method.
 void writeFloat(float value)
          API method.
 void writeInt(int value)
          API method.
 void writeLong(long value)
          API method.
 void writeObject(java.lang.Object value)
          API method.
 void writeShort(short value)
          API method.
 void writeString(java.lang.String value)
          API method.
 
Methods inherited from class org.objectweb.joram.client.jms.Message
acknowledge, clearProperties, convertJMSMessage, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getMomMsg, getObjectProperty, getOptionalHeader, getProperties, getPropertyNames, getShortProperty, getStringProperty, propertyExists, resetPropertiesRO, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setReadOnly, setShortProperty, setStringProperty, toString, toString, wrapMomMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.jms.Message
acknowledge, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
 

Field Detail

outputBuffer

private transient java.io.ByteArrayOutputStream outputBuffer
The array in which the written data is buffered.


outputStream

private transient java.io.DataOutputStream outputStream
The stream in which body data is written.


inputStream

private transient java.io.DataInputStream inputStream
The stream for reading the data.


prepared

private transient boolean prepared
true if the message has been sent since its last modification.


available

private transient int available

firstTimeBytesRead

private transient boolean firstTimeBytesRead

SHORT

private static final int SHORT
See Also:
Constant Field Values

CHAR

private static final int CHAR
See Also:
Constant Field Values

INT

private static final int INT
See Also:
Constant Field Values

LONG

private static final int LONG
See Also:
Constant Field Values

FLOAT

private static final int FLOAT
See Also:
Constant Field Values

DOUBLE

private static final int DOUBLE
See Also:
Constant Field Values

BOOLEAN

private static final int BOOLEAN
See Also:
Constant Field Values

STRING

private static final int STRING
See Also:
Constant Field Values

BYTE

private static final int BYTE
See Also:
Constant Field Values

BYTES

private static final int BYTES
See Also:
Constant Field Values

NULL

private static final int NULL
See Also:
Constant Field Values
Constructor Detail

StreamMessage

StreamMessage()
        throws javax.jms.JMSException
Instantiates a bright new StreamMessage.

Throws:
javax.jms.JMSException - In case of an error while creating the output stream.

StreamMessage

StreamMessage(Session session,
              Message momMsg)
        throws javax.jms.JMSException
Instantiates a StreamMessage wrapping a consumed MOM message containing a stream of bytes.

Parameters:
session - The consuming session.
momMsg - The MOM message to wrap.
Throws:
javax.jms.JMSException - In case of an error while creating the input stream.
Method Detail

clearBody

public void clearBody()
               throws javax.jms.JMSException
API method.

Specified by:
clearBody in interface javax.jms.Message
Overrides:
clearBody in class Message
Throws:
javax.jms.JMSException - In case of an error while closing the input or output streams.

prepareWrite

private void prepareWrite()
                   throws javax.jms.JMSException
Internal method called before each writing operation.

Throws:
javax.jms.MessageNotWriteableException - If the message body is READ only.
javax.jms.JMSException - If the stream could not be prepared for the writing operation.

writeBoolean

public void writeBoolean(boolean value)
                  throws javax.jms.JMSException
API method.

Specified by:
writeBoolean in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotWriteableException - If the message body is read-only.
javax.jms.JMSException - If the value could not be written on the stream.

writeByte

public void writeByte(byte value)
               throws javax.jms.JMSException
API method.

Specified by:
writeByte in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotWriteableException - If the message body is read-only.
javax.jms.JMSException - If the value could not be written on the stream.

writeBytes

public void writeBytes(byte[] value)
                throws javax.jms.JMSException
API method.

Specified by:
writeBytes in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotWriteableException - If the message body is read-only.
javax.jms.JMSException - If the value could not be written on the stream.

writeBytes

public void writeBytes(byte[] value,
                       int offset,
                       int length)
                throws javax.jms.JMSException
API method.

Specified by:
writeBytes in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotWriteableException - If the message body is read-only.
javax.jms.JMSException - If the value could not be written on the stream.

writeChar

public void writeChar(char value)
               throws javax.jms.JMSException
API method.

Specified by:
writeChar in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotWriteableException - If the message body is read-only.
javax.jms.JMSException - If the value could not be written on the stream.

writeDouble

public void writeDouble(double value)
                 throws javax.jms.JMSException
API method.

Specified by:
writeDouble in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotWriteableException - If the message body is read-only.
javax.jms.JMSException - If the value could not be written on the stream.

writeFloat

public void writeFloat(float value)
                throws javax.jms.JMSException
API method.

Specified by:
writeFloat in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotWriteableException - If the message body is read-only.
javax.jms.JMSException - If the value could not be written on the stream.

writeInt

public void writeInt(int value)
              throws javax.jms.JMSException
API method.

Specified by:
writeInt in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotWriteableException - If the message body is read-only.
javax.jms.JMSException - If the value could not be written on the stream.

writeLong

public void writeLong(long value)
               throws javax.jms.JMSException
API method.

Specified by:
writeLong in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotWriteableException - If the message body is read-only.
javax.jms.JMSException - If the value could not be written on the stream.

writeShort

public void writeShort(short value)
                throws javax.jms.JMSException
API method.

Specified by:
writeShort in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotWriteableException - If the message body is read-only.
javax.jms.JMSException - If the value could not be written on the stream.

writeString

public void writeString(java.lang.String value)
                 throws javax.jms.JMSException
API method.

Specified by:
writeString in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotWriteableException - If the message body is read-only.
javax.jms.JMSException - If the value could not be written on the stream.

writeObject

public void writeObject(java.lang.Object value)
                 throws javax.jms.JMSException
API method.

Specified by:
writeObject in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotWriteableException - If the message body is read-only.
javax.jms.MessageFormatException - If the value type is invalid.
javax.jms.JMSException - If the value could not be written on the stream.

readBoolean

public boolean readBoolean()
                    throws javax.jms.JMSException
API method.

Specified by:
readBoolean in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotReadableException - If the message body is write-only.
javax.jms.MessageFormatException - If reading the expected type is not possible.
javax.jms.MessageEOFException - Unexpected end of bytes array.
javax.jms.JMSException - internal error

readByte

public byte readByte()
              throws javax.jms.JMSException
API method.

Specified by:
readByte in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotReadableException - If the message body is write-only.
javax.jms.MessageFormatException - If reading the expected type is not possible.
javax.jms.MessageEOFException - Unexpected end of bytes array.
javax.jms.JMSException - internal error

readShort

public short readShort()
                throws javax.jms.JMSException
API method.

Specified by:
readShort in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotReadableException - If the message body is write-only.
javax.jms.MessageFormatException - If reading the expected type is not possible.
javax.jms.MessageEOFException - Unexpected end of bytes array.
javax.jms.JMSException - internal error

readChar

public char readChar()
              throws javax.jms.JMSException
API method.

Specified by:
readChar in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotReadableException - If the message body is write-only.
javax.jms.MessageFormatException - If reading the expected type is not possible.
javax.jms.MessageEOFException - Unexpected end of bytes array.
javax.jms.JMSException - internal error

readInt

public int readInt()
            throws javax.jms.JMSException
API method.

Specified by:
readInt in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotReadableException - If the message body is write-only.
javax.jms.MessageFormatException - If reading the expected type is not possible.
javax.jms.MessageEOFException - Unexpected end of bytes array.
javax.jms.JMSException - internal error

readLong

public long readLong()
              throws javax.jms.JMSException
API method.

Specified by:
readLong in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotReadableException - If the message body is write-only.
javax.jms.MessageFormatException - If reading the expected type is not possible.
javax.jms.MessageEOFException - Unexpected end of bytes array.
javax.jms.JMSException - internal error

readFloat

public float readFloat()
                throws javax.jms.JMSException
API method.

Specified by:
readFloat in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotReadableException - If the message body is write-only.
javax.jms.MessageFormatException - If reading the expected type is not possible.
javax.jms.MessageEOFException - Unexpected end of bytes array.
javax.jms.JMSException - internal error

readDouble

public double readDouble()
                  throws javax.jms.JMSException
API method.

Specified by:
readDouble in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotReadableException - If the message body is write-only.
javax.jms.MessageFormatException - If reading the expected type is not possible.
javax.jms.MessageEOFException - Unexpected end of bytes array.
javax.jms.JMSException - internal error

readBytes

public int readBytes(byte[] bytes)
              throws javax.jms.JMSException
API method.

Specified by:
readBytes in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotReadableException - If the message body is write-only.
javax.jms.MessageFormatException - If reading the expected type is not possible.
javax.jms.MessageEOFException - Unexpected end of bytes array.
javax.jms.JMSException - internal error

readString

public java.lang.String readString()
                            throws javax.jms.JMSException
API method.

Specified by:
readString in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotReadableException - If the message body is write-only.
javax.jms.MessageFormatException - If reading the expected type is not possible.
javax.jms.MessageEOFException - Unexpected end of bytes array.
javax.jms.JMSException - internal error

readObject

public java.lang.Object readObject()
                            throws javax.jms.JMSException
API method.

Specified by:
readObject in interface javax.jms.StreamMessage
Throws:
javax.jms.MessageNotReadableException - If the message body is write-only.
javax.jms.MessageFormatException - If reading the body is not possible.
javax.jms.MessageEOFException - Unexpected end of bytes array.
javax.jms.JMSException - internal error

reset

public void reset()
           throws javax.jms.JMSException
API method.

Specified by:
reset in interface javax.jms.StreamMessage
Throws:
javax.jms.JMSException - If an error occurs while closing the output stream.

prepare

protected void prepare()
                throws javax.jms.JMSException
Method actually preparing the message for sending by transferring the local body into the wrapped MOM message.

Overrides:
prepare in class Message
Throws:
javax.jms.MessageFormatException - If an error occurs while serializing.
javax.jms.JMSException


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.