Documentation ¶
Index ¶
- Variables
- func EncodedSize(n uint64) (size int)
- func GetNextBlock(data []byte) ([]byte, int, error)
- func Pack16(n uint16) []byte
- func Pack32(n uint32) []byte
- func Pack64(n uint64) []byte
- func Pack8(n uint8) []byte
- func PrependLength(data []byte) []byte
- func Unpack16(blob []byte) (uint16, int, error)
- func Unpack32(blob []byte) (uint32, int, error)
- func Unpack64(blob []byte) (uint64, int, error)
- func Unpack8(blob []byte) (uint8, int, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBufTooSmall = errors.New("varint: buf too small")
ErrBufTooSmall is returned when there is not enough data for parsing a varint.
Functions ¶
func EncodedSize ¶ added in v0.12.0
EncodedSize returns the size required to varint-encode an uint.
func GetNextBlock ¶
GetNextBlock extract the integer from the beginning of the given byte slice and returns the remaining bytes, the extracted integer, and whether there was an error.
func PrependLength ¶
PrependLength prepends the varint encoded length of the byte slice to itself.
func Unpack16 ¶
Unpack16 unpacks a VarInt into a uint16. It returns the extracted int, how many bytes were used and an error.
func Unpack32 ¶
Unpack32 unpacks a VarInt into a uint32. It returns the extracted int, how many bytes were used and an error.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.