Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

DataReaderUtf8TextExtensions

OfficeIMO.Data

Namespace
OfficeIMO.Data
Assembly
OfficeIMO.Core
Source revision
5d17dd5a4962 with working tree changes
Modifiers
static

Reads borrowed or copied UTF-8 text from ordinary tabular records.

Inheritance

  • object
  • DataReaderUtf8TextExtensions

Methods

public static long GetUtf8Bytes(IDataRecord record, int ordinal, long dataOffset, byte[]? buffer, int bufferOffset, int length) #

Copies a byte segment of the current field's UTF-8 text into a caller-owned buffer.

Parameters

record System.Data.IDataRecord required
The record containing the current row.
ordinal int required
The zero-based field ordinal.
dataOffset long required
The zero-based byte offset in the encoded text.
buffer byte[]? required
The destination, or null to query the total encoded byte length.
bufferOffset int required
The zero-based destination byte offset.
length int required
The maximum number of bytes to copy.

Returns

long The number of copied bytes, or the total UTF-8 byte length when buffer is null.

Exceptions

  • ArgumentNullException – The record is null.
  • ArgumentOutOfRangeException – An offset or length is negative, or bufferOffset exceeds the buffer length.
  • ArgumentException – The requested destination segment extends beyond the buffer.
  • IndexOutOfRangeException – The ordinal is outside the record's fields.
public static bool TryGetUtf8Text(IDataRecord record, int ordinal, out ReadOnlySpan<byte> text) #

Attempts to borrow text from a record that implements IDataReaderUtf8TextSource.

Parameters

record System.Data.IDataRecord required
The record containing the current row.
ordinal int required
The zero-based field ordinal.
text System.ReadOnlySpan<byte> required
The borrowed text when successful; otherwise an empty span.

Returns

bool False when the record or field does not offer borrowed UTF-8 text.

Exceptions

  • ArgumentNullException – The record is null.
  • IndexOutOfRangeException – The ordinal is outside the record's fields.