Uredi

Deli z drugimi prek


RandomAccess.Read Method

Definition

Overloads

Read(SafeFileHandle, IReadOnlyList<Memory<Byte>>, Int64)

Reads a sequence of bytes from given file at given offset.

Read(SafeFileHandle, Span<Byte>, Int64)

Reads a sequence of bytes from given file at given offset.

Read(SafeFileHandle, IReadOnlyList<Memory<Byte>>, Int64)

Source:
RandomAccess.cs
Source:
RandomAccess.cs
Source:
RandomAccess.cs

Reads a sequence of bytes from given file at given offset.

public:
 static long Read(Microsoft::Win32::SafeHandles::SafeFileHandle ^ handle, System::Collections::Generic::IReadOnlyList<Memory<System::Byte>> ^ buffers, long fileOffset);
public static long Read (Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.Collections.Generic.IReadOnlyList<Memory<byte>> buffers, long fileOffset);
static member Read : Microsoft.Win32.SafeHandles.SafeFileHandle * System.Collections.Generic.IReadOnlyList<Memory<byte>> * int64 -> int64
Public Shared Function Read (handle As SafeFileHandle, buffers As IReadOnlyList(Of Memory(Of Byte)), fileOffset As Long) As Long

Parameters

handle
SafeFileHandle

The file handle.

buffers
IReadOnlyList<Memory<Byte>>

A list of memory buffers. When this method returns, the contents of the buffers are replaced by the bytes read from the file.

fileOffset
Int64

The file position to read from.

Returns

The total number of bytes read into the buffers. This can be less than the number of bytes allocated in the buffers if that many bytes are not currently available, or zero (0) if the end of the file has been reached.

Exceptions

handle or buffers is null.

handle is invalid.

The file is closed.

The file does not support seeking (pipe or socket).

fileOffset is negative.

handle was not opened for reading.

An I/O error occurred.

Remarks

Position of the file is not advanced.

Applies to

Read(SafeFileHandle, Span<Byte>, Int64)

Source:
RandomAccess.cs
Source:
RandomAccess.cs
Source:
RandomAccess.cs

Reads a sequence of bytes from given file at given offset.

public:
 static int Read(Microsoft::Win32::SafeHandles::SafeFileHandle ^ handle, Span<System::Byte> buffer, long fileOffset);
public static int Read (Microsoft.Win32.SafeHandles.SafeFileHandle handle, Span<byte> buffer, long fileOffset);
static member Read : Microsoft.Win32.SafeHandles.SafeFileHandle * Span<byte> * int64 -> int
Public Shared Function Read (handle As SafeFileHandle, buffer As Span(Of Byte), fileOffset As Long) As Integer

Parameters

handle
SafeFileHandle

The file handle.

buffer
Span<Byte>

A region of memory. When this method returns, the contents of this region are replaced by the bytes read from the file.

fileOffset
Int64

The file position to read from.

Returns

The total number of bytes read into the buffer. This can be less than the number of bytes allocated in the buffer if that many bytes are not currently available, or zero (0) if the end of the file has been reached.

Exceptions

handle is null.

handle is invalid.

The file is closed.

The file does not support seeking (pipe or socket).

fileOffset is negative.

handle was not opened for reading.

An I/O error occurred.

Remarks

Position of the file is not advanced.

Applies to