Class
DataReaderUtf8TextExtensions
OfficeIMO.Data
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
- The record containing the current row.
- ordinal int
- The zero-based field ordinal.
- dataOffset long
- The zero-based byte offset in the encoded text.
- buffer byte[]?
- The destination, or null to query the total encoded byte length.
- bufferOffset int
- The zero-based destination byte offset.
- length int
- 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
- The record containing the current row.
- ordinal int
- The zero-based field ordinal.
- text System.ReadOnlySpan<byte>
- 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.