Show / Hide Table of Contents

Struct Leb128<T>

Represents encoder and decoder for 7-bit encoded integers.

Implements
ISupplier<T>
IFunctional
IResettable
Inherited Members
ValueType.Equals(object)
ValueType.GetHashCode()
ValueType.ToString()
object.GetType()
object.Equals(object, object)
object.ReferenceEquals(object, object)
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 Source

MaxSizeInBytes

Maximum size of encoded T, in bytes.

Declaration
public static int MaxSizeInBytes { get; }
Property Value
Type Description
int
View Source

Value

Gets a value represented by the encoder.

Declaration
public T Value { readonly get; set; }
Property Value
Type Description
T

Methods

View Source

Append(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.

View Source

GetEnumerator()

Gets an enumerator over encoded octets.

Declaration
public readonly Leb128<T>.Enumerator GetEnumerator()
Returns
Type Description
Leb128<T>.Enumerator
View Source

Reset()

Resets the decoder.

Declaration
public void Reset()

Implements

ISupplier<TResult>
IFunctional
IResettable

Extension Methods

BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, params ReadOnlySpan<T>)
Enumerator.Skip<TEnumerator, T>(ref TEnumerator, int)

See Also

LEB128 encoding
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾