Documentation ¶
Index ¶
- func SignExtend14Bit(val uint16) int64
- func SignExtend24Bit(val uint32) int64
- func SignExtend2Bit(val uint8) int64
- func SignExtend4Bit(nibble uint8) int64
- func SignExtend6Bit(nibble uint8) int64
- type Decoder
- func (d *Decoder) EOF() (bool, error)
- func (d *Decoder) NextByte() (byte, error)
- func (d *Decoder) Offset() int64
- func (d *Decoder) ReadByte() (byte, error)
- func (d *Decoder) ReadBytes(number int) ([]byte, error)
- func (d *Decoder) ReadInt() (int64, error)
- func (d *Decoder) ReadSignedVB() (int32, error)
- func (d *Decoder) ReadTag2_3S32() ([]int64, error)
- func (d *Decoder) ReadTag8_4S16V1() ([]int64, error)
- func (d *Decoder) ReadTag8_4S16V2() ([]int64, error)
- func (d *Decoder) ReadTag8_8SVB(valueCount int) ([]int64, error)
- func (d *Decoder) ReadUnsignedVB() (uint32, error)
- type ReadError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder can read various form of encoded bytes
func NewDecoder ¶
NewDecoder returns a new instance of a Decoder
func (*Decoder) ReadSignedVB ¶
ReadSignedVB applies a pre-processing step to fold negative values into positive ones, then the resulting unsigned number is encoded using unsigned variable byte encoding.
func (*Decoder) ReadTag2_3S32 ¶
ReadTag2_3S32 returns
func (*Decoder) ReadTag8_4S16V1 ¶
ReadTag8_4S16V1 returns
func (*Decoder) ReadTag8_4S16V2 ¶
ReadTag8_4S16V2 returns
func (*Decoder) ReadTag8_8SVB ¶
ReadTag8_8SVB first an 8-bit (one byte) header is written. This header has its bits set to zero when the corresponding field (from a maximum of 8 fields) is set to zero, otherwise the bit is set to one. The least-signficant bit in the header corresponds to the first field to be written. This header is followed by the values of only the fields which are non-zero, written using signed variable byte encoding.
func (*Decoder) ReadUnsignedVB ¶
ReadUnsignedVB reads the most straightforward encoding. This encoding uses the lower 7 bits of an encoded byte to store the lower 7 bits of the field's value. The high bit of that encoded byte is set to one if more than 7 bits are required to store the value. If the value did exceed 7 bits, the lower 7 bits of the value (which were written to the log) are removed from the value (by right shift), and the encoding process begins again with the new value.