varint

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2019 License: GPL-3.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNextBlock

func GetNextBlock(data []byte) ([]byte, int, error)

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 Pack16

func Pack16(n uint16) []byte

Pack16 packs a uint16 into a VarInt.

func Pack32

func Pack32(n uint32) []byte

Pack32 packs a uint32 into a VarInt.

func Pack64

func Pack64(n uint64) []byte

Pack64 packs a uint64 into a VarInt.

func Pack8

func Pack8(n uint8) []byte

Pack8 packs a uint8 into a VarInt.

func PrependLength

func PrependLength(data []byte) []byte

PrependLength prepends the varint encoded length of the byte slice to itself.

func Unpack16

func Unpack16(blob []byte) (uint16, int, error)

Unpack16 unpacks a VarInt into a uint16. It returns the extracted int, how many bytes were used and an error.

func Unpack32

func Unpack32(blob []byte) (uint32, int, error)

Unpack32 unpacks a VarInt into a uint32. It returns the extracted int, how many bytes were used and an error.

func Unpack64

func Unpack64(blob []byte) (uint64, int, error)

Unpack64 unpacks a VarInt into a uint64. It returns the extracted int, how many bytes were used and an error.

func Unpack8

func Unpack8(blob []byte) (uint8, int, error)

Unpack8 unpacks a VarInt into a uint8. It returns the extracted int, how many bytes were used and an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL