zl程序教程

您现在的位置是:首页 >  后端

当前栏目

C# FileStream.Read Method

c# Read method FileStream
2023-09-14 09:02:14 时间

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

)


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.


Return Value Type: System.Int32
The 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. Exceptions
在我们使用最常见的buffer write 中 read-on-write 问题指的是当我需要进行小于4k 大小buffer write 的时候, 需要先将数据所在的page 从disk 中读取出放入到page cache, 在page cache 中修改好, 然后再将