# HtmlDataUri

Media-neutral data URI with bounded-size inspection and byte decoding.

Class 

`OfficeIMO.Html`

**Namespace**

`OfficeIMO.Html`

**Assembly**

`OfficeIMO.Html`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[HtmlDataUri.cs:28](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Resources/HtmlDataUri.cs#L28)

**Modifiers**

sealed

Media-neutral data URI with bounded-size inspection and byte decoding.

## Inheritance

- object
- HtmlDataUri

## Usage

Explore 1 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Accepted by parameters 1

- Method [HtmlDataUri.TryParse](/api/html/officeimo-html-htmldatauri/#method-tryparse-string-officeimo-html-htmldatauri) parameter `dataUri`

Filter members 

Show inherited

## Methods

`public byte[] DecodeBytes()` [#](#method-decodebytes)

[HtmlDataUri.cs:60](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Resources/HtmlDataUri.cs#L60)

Decodes the payload as bytes.

Returns

`byte[]`

`public string DecodeText(IHtmlEncodingProvider? encodingProvider = null)` [#](#method-decodetext-officeimo-html-dom-ihtmlencodingprovider)

[HtmlDataUri.cs:80](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Resources/HtmlDataUri.cs#L80)

Decodes the payload using its declared charset, or UTF-8 when no charset is declared.

Parameters

**encodingProvider OfficeIMO.Html.Dom.IHtmlEncodingProvider? = null optional**

Returns

`string`

`public long EstimateDecodedByteCount()` [#](#method-estimatedecodedbytecount)

[HtmlDataUri.cs:97](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Resources/HtmlDataUri.cs#L97)

Calculates decoded byte count without allocating the decoded payload.

Returns

`long`

`public bool TryDecodeBytes(out byte[] bytes)` [#](#method-trydecodebytes-byte)

[HtmlDataUri.cs:69](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Resources/HtmlDataUri.cs#L69)

Attempts to decode the payload as bytes.

Parameters

**bytes byte[] required**

Returns

`bool`

`public bool TryDecodeText(out string text, IHtmlEncodingProvider? encodingProvider = null)` [#](#method-trydecodetext-string-officeimo-html-dom-ihtmlencodingprovider)

[HtmlDataUri.cs:84](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Resources/HtmlDataUri.cs#L84)

Attempts to decode the payload using its declared charset, or UTF-8 when none is declared.

Parameters

**text string required**

**encodingProvider OfficeIMO.Html.Dom.IHtmlEncodingProvider? = null optional**

Returns

`bool`

`public bool TryEstimateDecodedByteCount(out long byteCount)` [#](#method-tryestimatedecodedbytecount-int64)

[HtmlDataUri.cs:114](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Resources/HtmlDataUri.cs#L114)

Attempts to calculate decoded byte count without allocating the decoded payload.

Parameters

**byteCount long required**

Returns

`bool`

`public static bool TryParse(string? source, out HtmlDataUri dataUri)` [#](#method-tryparse-string-officeimo-html-htmldatauri)

[HtmlDataUri.cs:28](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Resources/HtmlDataUri.cs#L28)

Tries to parse a data URI with an explicit media type.

Parameters

**source string? required**

**dataUri OfficeIMO.Html.HtmlDataUri required**

Returns

`bool`

## 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?`

## Properties

`public string Metadata { get; }` [#](#property-metadata)

[HtmlDataUri.cs:15](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Resources/HtmlDataUri.cs#L15)

Metadata without the leading data: prefix.

`public string MediaType { get; }` [#](#property-mediatype)

[HtmlDataUri.cs:18](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Resources/HtmlDataUri.cs#L18)

Declared media type.

`public string Data { get; }` [#](#property-data)

[HtmlDataUri.cs:21](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Resources/HtmlDataUri.cs#L21)

Raw payload after the comma separator.

`public bool IsBase64 { get; }` [#](#property-isbase64)

[HtmlDataUri.cs:24](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Resources/HtmlDataUri.cs#L24)

Whether the payload uses base64 encoding.

<!-- PowerForge markdown artifact sha256:92ED335252BCD01F389442233EE2AE2C26BED3DB8706FFC486DAD18F69D13148 -->
