Zarr.NET  0.6.1
Zarr reader and writer in .NET
Loading...
Searching...
No Matches
ZarrNET.BytesCodec Class Referencesealed

The "bytes" array-to-bytes codec (Zarr v3 spec section 3.3.2). Handles endianness conversion when translating between the in-memory array representation and a flat byte sequence. This is always the first codec in a Zarr v3 pipeline. More...

Inheritance diagram for ZarrNET.BytesCodec:
ZarrNET.IZarrCodec

Public Member Functions

 BytesCodec (ByteOrder byteOrder=ByteOrder.LittleEndian)
 
Task< byte[]> DecodeAsync (byte[] input, CancellationToken ct=default)
 Decodes bytes produced by the previous codec step.
 
Task< byte[]> EncodeAsync (byte[] input, CancellationToken ct=default)
 Encodes bytes for the next codec step.
 
- Public Member Functions inherited from ZarrNET.IZarrCodec

Properties

string Name [get]
 Codec name as it appears in zarr.json (e.g. "gzip", "zstd", "bytes").
 
- Properties inherited from ZarrNET.IZarrCodec

Detailed Description

The "bytes" array-to-bytes codec (Zarr v3 spec section 3.3.2). Handles endianness conversion when translating between the in-memory array representation and a flat byte sequence. This is always the first codec in a Zarr v3 pipeline.

Constructor & Destructor Documentation

◆ BytesCodec()

ZarrNET.BytesCodec.BytesCodec ( ByteOrder byteOrder = ByteOrder::LittleEndian)
16 {
17 _byteOrder = byteOrder;
18 }

Member Function Documentation

◆ DecodeAsync()

Task< byte[]> ZarrNET.BytesCodec.DecodeAsync ( byte[] input,
CancellationToken ct = default )

Decodes bytes produced by the previous codec step.

Implements ZarrNET.IZarrCodec.

25 {
26 ct.ThrowIfCancellationRequested();
27
28 var result = NeedsSwap()
29 ? SwapByteOrder(input)
30 : input;
31
32 return Task.FromResult(result);
33 }

◆ EncodeAsync()

Task< byte[]> ZarrNET.BytesCodec.EncodeAsync ( byte[] input,
CancellationToken ct = default )

Encodes bytes for the next codec step.

Implements ZarrNET.IZarrCodec.

36 {
37 ct.ThrowIfCancellationRequested();
38
39 // Swap is its own inverse
40 var result = NeedsSwap()
41 ? SwapByteOrder(input)
42 : input;
43
44 return Task.FromResult(result);
45 }

Property Documentation

◆ Name

string ZarrNET.BytesCodec.Name
get

Codec name as it appears in zarr.json (e.g. "gzip", "zstd", "bytes").

Implements ZarrNET.IZarrCodec.


The documentation for this class was generated from the following file: