Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/

API Reference

Class

DataReaderUtf8TextExtensions

Namespace OfficeIMO.Data
Assembly OfficeIMO.Core
Modifiers static

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

Inheritance

  • Object
  • DataReaderUtf8TextExtensions

Methods

public static Int64 GetUtf8Bytes(IDataRecord record, Int32 ordinal, Int64 dataOffset, Byte[] buffer, Int32 bufferOffset, Int32 length) #
Returns: Int64

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

Parameters

record System.Data.IDataRecord requiredposition: 0
The record containing the current row.
ordinal System.Int32 requiredposition: 1
The zero-based field ordinal.
dataOffset System.Int64 requiredposition: 2
The zero-based byte offset in the encoded text.
buffer System.Byte[] requiredposition: 3
The destination, or null to query the total encoded byte length.
bufferOffset System.Int32 requiredposition: 4
The zero-based destination byte offset.
length System.Int32 requiredposition: 5
The maximum number of bytes to copy.

Returns

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 Boolean TryGetUtf8Text(IDataRecord record, Int32 ordinal, out ReadOnlySpan<Byte> text) #
Returns: Boolean

Attempts to borrow text from a record that implements IDataReaderUtf8TextSource.

Parameters

record System.Data.IDataRecord requiredposition: 0
The record containing the current row.
ordinal System.Int32 requiredposition: 1
The zero-based field ordinal.
text System.ReadOnlySpan{System.Byte}@ requiredposition: 2
The borrowed text when successful; otherwise an empty span.

Returns

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.