# DataReaderUtf8TextExtensions

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

Class 

`OfficeIMO.Data`

**Namespace**

`OfficeIMO.Data`

**Assembly**

`OfficeIMO.Core`

**Source revision**

`12abd7a46d18` with working tree changes

**Source**

[DataReaderUtf8Text.Copy.cs:42](https://github.com/EvotecIT/OfficeIMO/blob/12abd7a46d18971dcbebc70da46ea1f63c6779bd/OfficeIMO.Core/Data/DataReaderUtf8Text.Copy.cs#L42)

**Modifiers**

static

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

## Inheritance

- object
- DataReaderUtf8TextExtensions

Filter members 

Show inherited

## Methods

`public static long GetUtf8Bytes(IDataRecord record, int ordinal, long dataOffset, byte[]? buffer, int bufferOffset, int length)` [#](#method-getutf8bytes-data-idatarecord-int32-int64-byte-int32-int32)

[DataReaderUtf8Text.Copy.cs:42](https://github.com/EvotecIT/OfficeIMO/blob/12abd7a46d18971dcbebc70da46ea1f63c6779bd/OfficeIMO.Core/Data/DataReaderUtf8Text.Copy.cs#L42)

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)` [#](#method-trygetutf8text-data-idatarecord-int32-readonlyspan-system-byte)

[DataReaderUtf8Text.cs:42](https://github.com/EvotecIT/OfficeIMO/blob/12abd7a46d18971dcbebc70da46ea1f63c6779bd/OfficeIMO.Core/Data/DataReaderUtf8Text.cs#L42)

Attempts to borrow text from a record that implements [IDataReaderUtf8TextSource](/api/core/officeimo-data-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.

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

<!-- PowerForge markdown artifact sha256:4A452C9B1DF2695E4BE0B58ADA1BBF524024FE43DA0EE1BDCE56981B2B3C1AF5 -->
