BinaryReaderRead Method (Byte, Int32, Int32) |
Reads the specified number of bytes from the stream, starting from a specified point in the byte array.
Namespace: System.IOAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public virtual int Read(
byte[] buffer,
int index,
int count
)
Parameters
- buffer
- Type: SystemByte
The buffer to read data into. - index
- Type: SystemInt32
The starting point in the buffer at which to begin reading into the buffer. - count
- Type: SystemInt32
The number of bytes to read.
Return Value
Type:
Int32The number of bytes read into
buffer. This might be less than the number of bytes requested if that many bytes are not available, or it might be zero if the end of the stream is reached.
Exceptions Exception | Condition |
---|
ArgumentException | The buffer length minus index is less than count. -or-The number of decoded characters to read is greater than count. This can happen if a Unicode decoder returns fallback characters or a surrogate pair. |
ArgumentNullException | buffer is null. |
ArgumentOutOfRangeException | index or count is negative. |
ObjectDisposedException | The stream is closed. |
IOException | An I/O error occurs. |
See Also