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

Zstandard bytes-to-bytes codec. Uses ZstdSharp (managed wrapper around the native zstd library, available as a NuGet package). NuGet: ZstdSharp.Port (pure managed port, no native deps) More...

Inheritance diagram for ZarrNET.ZstdCodec:
ZarrNET.IZarrCodec

Public Member Functions

 ZstdCodec (int level=3)
 
Parameters
levelCompression level 0–22. Default 3 matches zstd's default.

 
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

Zstandard bytes-to-bytes codec. Uses ZstdSharp (managed wrapper around the native zstd library, available as a NuGet package). NuGet: ZstdSharp.Port (pure managed port, no native deps)

Constructor & Destructor Documentation

◆ ZstdCodec()

ZarrNET.ZstdCodec.ZstdCodec ( int level = 3)

Parameters
levelCompression level 0–22. Default 3 matches zstd's default.

18 {
19 _level = Math.Clamp(level, 0, 22);
20 }

Member Function Documentation

◆ DecodeAsync()

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

Decodes bytes produced by the previous codec step.

Implements ZarrNET.IZarrCodec.

27 {
28 ct.ThrowIfCancellationRequested();
29
30 using var decompressor = new Decompressor();
31 var result = decompressor.Unwrap(input);
32
33 return Task.FromResult(result.ToArray());
34 }

◆ EncodeAsync()

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

Encodes bytes for the next codec step.

Implements ZarrNET.IZarrCodec.

37 {
38 ct.ThrowIfCancellationRequested();
39
40 using var compressor = new Compressor(_level);
41 var result = compressor.Wrap(input);
42
43 return Task.FromResult(result.ToArray());
44 }

Property Documentation

◆ Name

string ZarrNET.ZstdCodec.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: