Struct Leb128<T>
Represents encoder and decoder for 7-bit encoded integers.
Inherited Members
Namespace: DotNext.Buffers.Binary
Assembly: DotNext.dll
Syntax
public struct Leb128<T> : ISupplier<T>, IFunctional, IResettable where T : struct, IBinaryInteger<T>
Type Parameters
| Name | Description |
|---|---|
| T | The type of the integer. |
Remarks
Note that encoding of signed and unsigned integers produce different octets.
Properties
View SourceMaxSizeInBytes
Maximum size of encoded T, in bytes.
Declaration
public static int MaxSizeInBytes { get; }
Property Value
| Type | Description |
|---|---|
| int |
Value
Gets a value represented by the encoder.
Declaration
public T Value { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| T |
Methods
View SourceAppend(byte)
Decodes an octet.
Declaration
public bool Append(byte b)
Parameters
| Type | Name | Description |
|---|---|---|
| byte | b | The byte that represents a part of 7-bit encoded integer. |
Returns
| Type | Description |
|---|---|
| bool | true if the decoder expects more data to decode; false if the last octet detected. |
Exceptions
| Type | Condition |
|---|---|
| InvalidDataException | The maximum number of octets reached. |
GetEnumerator()
Gets an enumerator over encoded octets.
Declaration
public readonly Leb128<T>.Enumerator GetEnumerator()
Returns
| Type | Description |
|---|---|
| Leb128<T>.Enumerator |
Reset()
Resets the decoder.
Declaration
public void Reset()