Table of Contents

Struct AssetBytes

Namespace
EncDotNet.S100.Core
Assembly
EncDotNet.S100.Core.dll

A read-only, in-memory view of an asset previously read from an IAssetSource. Backed by a ReadOnlyMemory<T> so cache hits can be served without copying.

public readonly record struct AssetBytes : IEquatable<AssetBytes>
Implements
Inherited Members

Remarks

Intended for small, read-only assets (Lua source, XSLT templates, SVG symbols, palette XML, Feature/Portrayal Catalogue documents) whose contents are immutable for the lifetime of the originating source. See S-100 Edition 5.2.1 Part 4 (Feature Catalogue) and Part 9 (Portrayal Catalogue) for the canonical asset shapes.

Constructors

AssetBytes(ReadOnlyMemory<byte>, string)

A read-only, in-memory view of an asset previously read from an IAssetSource. Backed by a ReadOnlyMemory<T> so cache hits can be served without copying.

public AssetBytes(ReadOnlyMemory<byte> Bytes, string RelativePath)

Parameters

Bytes ReadOnlyMemory<byte>

The asset contents.

RelativePath string

The forward-slash relative path that produced these bytes, preserved for diagnostics and to keep AssetBytes self-describing.

Remarks

Intended for small, read-only assets (Lua source, XSLT templates, SVG symbols, palette XML, Feature/Portrayal Catalogue documents) whose contents are immutable for the lifetime of the originating source. See S-100 Edition 5.2.1 Part 4 (Feature Catalogue) and Part 9 (Portrayal Catalogue) for the canonical asset shapes.

Properties

Bytes

The asset contents.

public ReadOnlyMemory<byte> Bytes { get; init; }

Property Value

ReadOnlyMemory<byte>

RelativePath

The forward-slash relative path that produced these bytes, preserved for diagnostics and to keep AssetBytes self-describing.

public string RelativePath { get; init; }

Property Value

string

Methods

AsStream()

Returns a non-seekable-aware Stream over the asset bytes. The returned stream is read-only and does not own the underlying buffer; disposing it does not affect the cached AssetBytes instance.

public Stream AsStream()

Returns

Stream

A stream positioned at the start of the asset.

AsString(Encoding?)

Decodes the asset bytes as text using the supplied encoding (defaulting to UTF-8 when null).

public string AsString(Encoding? encoding = null)

Parameters

encoding Encoding

The encoding to use, or null for UTF-8 (the default for S-100 XML and Lua content).

Returns

string