varint

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrVarIntTooBig = errors.New("mcproto: var int is too big")
)

Functions

func DecodeReaderVarInt

func DecodeReaderVarInt(reader io.Reader) (result int32, numRead int32, err error)

DecodeReaderVarInt takes an io.Reader as a parameter and returns in order:

- the result varint

- the number of bytes read

- an eventual error

NOTE: It returns the number of bytes read even in occurance of an error

func EncodeVarInt

func EncodeVarInt(inputValue int32) (varint []byte, n int32)

EncoeVarInt is an implementation of the varint encoding as specified on wiki.vg

It takes an int32 as an input, and returns the encoded varint in the form of a byte slice, and also returns n which is the number of bytes the varint takes

Types

This section is empty.

Jump to

Keyboard shortcuts

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