C# FileStream.Read Method
Reads a block of bytes from the stream and writes the data in a given buffer.public override int Read(byte[] array,int offset,int count)ParametersarrayType: System.Byte[]When this
Reads a block of bytes from the stream and writes the data in a given buffer.
public override int Read(
byte[] array,
int offset,
int count
)
Parameters
-
array
-
Type: System.Byte []
When this method returns, contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.
-
offset
-
Type: System.Int32
The byte offset in array at which the read bytes will be placed.
-
count
-
Type: System.Int32
The maximum number of bytes to read.
Return Value
Type: System.Int32The total number of bytes read into the buffer. This might be less than the number of bytes requested if that number of bytes are not currently available, or zero if the end of the stream is reached.
Exception | Condition |
---|---|
ArgumentNullException |
array is null. |
ArgumentOutOfRangeException |
offset or count is negative. |
NotSupportedException |
The stream does not support reading. |
IOException |
An I/O error occurred. |
ArgumentException |
offset and count describe an invalid range in array. |
ObjectDisposedException |
Methods were called after the stream was closed. |

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。
更多推荐
所有评论(0)