readBytes

 

public int readBytes(byte[] value) throws JMSException;

Reads a byte array field from the stream message into the specified byte[] object (the read buffer).

To read the field value, readBytes() should be successively called until it returns a value less than the length of the read buffer. The values of the bytes in the buffer following the last byte read are undefined.

If readBytes() returns a value equal to the length of the buffer, a subsequent readBytes() call must be made. If there are no more bytes to be read this call will return -1.

If the bytes array field value is null, readBytes() returns -1.

If the bytes array field value is empty, readBytes() returns 0.

After the first readBytes() call on a byte[] field value has been made, the full value of the field must be read before the next field can be read. An attempt to read the next field before that has been done will throw a MessageFormatException.

Parameters

  • value - the buffer into which the data is read.

Returns

  • the total number of bytes read into the buffer, or -1 if there is no more data because the end of the byte field has been reached.

Exceptions

  • JMSException - if JMS fails to read the message due to an internal JMS error.

  • MessageEOFException - if an end of message stream.

  • MessageFormatException - if this type conversion is not valid.

  • MessageNotReadableException - if the message is in write-only mode.


uj26990_