Reads a block of bytes from the current stream into a byte array and advances the current position by count bytes.
[Visual Basic] Overloads Overridable Public Function Read( _ ByVal buffer() As Byte, _ ByVal index As Integer, _ ByVal count As Integer _ ) As Integer [C#] public virtual int Read( byte[] buffer, int index, int count ); [C++] public: virtual int Read( unsigned char* buffer[], int index, int count ); [JScript] public function Read( buffer : Byte[], index : int, count : int ) : int;
The number of characters read into buffer. This may be less than the number of bytes requested if that many bytes are not available, or it may be zero if the end of the stream is reached.
Exception Type | Condition |
---|---|
ArgumentException | The buffer length minus index is less than count. |
ArgumentNullException | buffer is a null reference (in Visual Basic Nothing). |
ArgumentOutOfRangeException | index or count is negative. |
IOException | The stream is a null reference (Nothing) or closed. |
BinaryReader Class | BinaryReader Members | System.IO Namespace | BinaryReader.Read Overload List