C# Class HdrHistogram.ZigZagEncoding

Exposes methods to write values to a ByteBuffer with ZigZag LEB128-64b9B-variant encoding. (Little Endian Base128 Encoding, 64bit value store as a maximum of 9Bytes)

This class provides encoding and decoding methods for writing and reading ZigZag-encoded LEB128-64b9B-variant(Little Endian Base 128) values to/from a ByteBuffer. LEB128's variable length encoding provides for using a smaller number of bytes for smaller values, and the use of ZigZag encoding allows small(closer to zero) negative values to use fewer bytes. Details on both LEB128 and ZigZag can be readily found elsewhere.

The LEB128-64b9B-variant encoding used here diverges from the "original" LEB128 as it extends to 64 bit values. In the original LEB128, a 64 bit value can take up to 10 bytes in the stream, where this variant's encoding of a 64 bit values will max out at 9 bytes. As such, this encoder/decoder should NOT be used for encoding or decoding "standard" LEB128 formats (e.g.Google Protocol Buffers).

ZigZag Encoding explained here - https://gist.github.com/mfuerstenau/ba870a29e16536fdbaba LEB128 explained here - https://en.wikipedia.org/wiki/LEB128

Afficher le fichier Open project: HdrHistogram/HdrHistogram.NET

Méthodes publiques

Méthode Description
GetLong ( ByteBuffer buffer ) : long

Reads an LEB128-64b9B ZigZag encoded 64 bit integer (long) value from the given buffer.

PutLong ( ByteBuffer buffer, long value ) : void

Writes a 64 bit integer (long) value to the given buffer in LEB128-64b9B-variant ZigZag encoded format.

Method Details

GetLong() public static méthode

Reads an LEB128-64b9B ZigZag encoded 64 bit integer (long) value from the given buffer.
public static GetLong ( ByteBuffer buffer ) : long
buffer HdrHistogram.Utilities.ByteBuffer The buffer to read from.
Résultat long

PutLong() public static méthode

Writes a 64 bit integer (long) value to the given buffer in LEB128-64b9B-variant ZigZag encoded format.
public static PutLong ( ByteBuffer buffer, long value ) : void
buffer HdrHistogram.Utilities.ByteBuffer The buffer to write to.
value long The value to write to the buffer.
Résultat void