Mono Class Library: System.IO.Stream Overview | Members

System.IO.Stream.Read Method

Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read. [Edit]

public abstract int Read (byte[] buffer, int offset, int count)

Parameters

buffer
A byte array. When this method returns, the elements between offset and (offset + count - 1) are replaced by the bytes read from the current source. [Edit]
offset
A int that specifies the zero based byte offset in buffer at which to begin storing the data read from the current stream. [Edit]
count
A int that specifies the maximum number of bytes to be read from the current stream. [Edit]

Returns

A int that specifies the total number of bytes read into the buffer, or zero if the end of the stream has been reached before any data can be read. [Edit]

Exceptions

TypeReason
ArgumentException(offset + count - 1) is greater than the length of buffer. [Edit]
ArgumentNullExceptionbuffer is null. [Edit]
ArgumentOutOfRangeExceptionoffset or count is less than zero. [Edit]
System.IO.IOException An I/O error occurred. [Edit]
NotSupportedExceptionThe current stream does not support reading. [Edit]
ObjectDisposedExceptionThe stream is closed. [Edit]

Remarks

Note: Use the Stream.CanRead property to determine whether the current instance supports reading.

Operation
As described above.

[Edit]

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0