Reads a portion of the bytes message stream. If the length of array value is less than the number of bytes remaining to be read from the stream, the array should be filled. A subsequent call reads the next increment, and so on. If the number of bytes remaining in the stream is less than the length of array value, the bytes should be read into the array. The return value of the total number of bytes read will be less than the length of the array, indicating that there are no more bytes left to be read from the stream. The next read of the stream returns -1. If length is negative, or length is greater than the length of the array value, then an Exception is thrown. No bytes will be read from the stream for this exception case.

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

Syntax

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

Parameters

value
Type: array<System..::..Byte>[]()[][]
The byte array that will be used as a buffer to read into.
length
Type: System..::..Int32
The amount of bytes to read into the buffer.

Return Value

A Int32 The number of bytes read into the passed byte array, or -1 if there are no more bytes left to be read from the stream.

Exceptions

ExceptionCondition
Apache.NMS..::..MessageNotReadableException Thrown when the Message is in write-only mode.
Apache.NMS..::..NMSException Thrown when there is an unhandled exception thrown from the provider.

See Also