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 value of the bytes in the buffer following the last byte read is 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 returns -1. If the byte array field value is null, ReadBytes returns -1. If the byte array field value is empty, ReadBytes returns 0. Once the first ReadBytes call on a byte[] field value has been made, the full value of the field must be read before it is valid to read the next field. An attempt to read the next field before that has been done will throw a MessageFormatException. To read the byte field value into a new byte[] object, use the ReadObject method.

Namespace:  Apache.NMS
Assembly:  Apache.NMS (in Apache.NMS.dll)

Syntax

Visual Basic
Function ReadBytes ( _
	value As Byte() _
) As Integer
C#
int ReadBytes(
	byte[] value
)
Visual C++
int ReadBytes(
	array<unsigned char>^ value
)
JavaScript
function readBytes(value);

Parameters

value
Type: array<System..::..Byte>[]()[][]
A Byte

Return Value

A Byte 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

ExceptionCondition
Apache.NMS..::..NMSException if the NMS provider fails to read the message due to some internal error.
Apache.NMS..::..MessageEOFException if unexpected end of message stream has been reached.
Apache.NMS..::..MessageFormatException if this type conversion is invalid.
Apache.NMS..::..MessageNotReadableException if the message is in write-only mode.

See Also