Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeBits ¶
EncodeBits takes a slice of *Bits and encodes them as a single []byte. The []*Bits can be recovered with DecodeBits. The structure of the encoded data is a CompactUint64 for the data length. Then a byte bit length to use when looking up lengths. Then all the lengths are encoded, then all the Bits are encoded.
func EncodeBits ¶
EncodeBits takes a slice of *Bits and encodes them as a single []byte. The []*Bits can be recovered with DecodeBits.
func Int64SignLSB ¶
Int64SignLSB converts an int64 to a uint64 by placing the sign in the least significant bit (as opposted to 2's compliment). For compact encoding, this makes increases the number of leading zeros that can be dropped for compact encoding.
Types ¶
type Deserializer ¶
type Deserializer struct {
*rye.Deserializer
}
func NewDeserializer ¶
func NewDeserializer(data []byte) Deserializer
func (Deserializer) CompactInt64 ¶
func (d Deserializer) CompactInt64() int64
CompactInt64 reads an Int64 in compact form.
func (Deserializer) CompactSlice ¶
func (d Deserializer) CompactSlice() []byte
CompactSlice reads a byte slice in compact form.
func (Deserializer) CompactString ¶
func (d Deserializer) CompactString() string
CompactString reads the string as a compact byte slice.
func (Deserializer) CompactSub ¶
func (d Deserializer) CompactSub() Deserializer
CompactSub returns a Sub-Deserializer where the underlying slice is from CompactSlice. The index of the parent is placed at the end of the data allocated to the Sub-Deserializer.
func (Deserializer) CompactUint64 ¶
func (d Deserializer) CompactUint64() uint64
CompactUint64 reads a Uint64 in compact form.
type Serializer ¶
type Serializer struct {
*rye.Serializer
}
func NewSerializer ¶
func NewSerializer(size int) Serializer
func (Serializer) CompactInt64 ¶
func (s Serializer) CompactInt64(x int64)
CompactInt64 writes an Int64 in compact form.
func (Serializer) CompactSlice ¶
func (s Serializer) CompactSlice(data []byte)
CompactSlice writes a byte slice in compact form.
func (Serializer) CompactString ¶
func (s Serializer) CompactString(str string)
CompactString writes the string as a compact byte slice.
func (Serializer) CompactUint64 ¶
func (s Serializer) CompactUint64(x uint64)
CompactUint64 writes x to the Serializer in the CompactUint64 format.