encoding

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VarIntMaxByteSize = 5
)

Variables

View Source
var (
	// ErrVarIntTooLarge is returned when a read varint was too large
	// (more than 5 bytes)
	ErrVarIntTooLarge = errors.New("VarInt too large")
)

Functions

func WriteString

func WriteString(w io.Writer, str String) error

WriteString writes a VarInt prefixed utf-8 string to the writer.

func WriteUnsignedByte

func WriteUnsignedByte(w io.Writer, value UnsignedByte) error

func WriteUnsignedShort

func WriteUnsignedShort(buff io.Writer, value UnsignedShort) error

WriteUnsignedShort writes the passed UnsignedShort to the writer

func WriteVarInt

func WriteVarInt(w io.Writer, value VarInt) error

WriteVarInt writes the passed VarInt encoded integer to the writer.

Types

type String

type String string

func ReadString

func ReadString(r io.Reader) (String, error)

ReadString reads a VarInt prefixed utf-8 string to the reader. It uses io.ReadFull to ensure all bytes are read.

type UnsignedByte

type UnsignedByte byte

Minecrat Protocol UnsignedByte type

func ReadUnsignedByte

func ReadUnsignedByte(r io.Reader) (UnsignedByte, error)

type UnsignedShort

type UnsignedShort uint16

Minecraft Protocol UnsignedShort type

func ReadUnsignedShort

func ReadUnsignedShort(buff io.Reader) (UnsignedShort, error)

ReadUnsignedShort reads an UnsignedShort from the reader

type VarInt

type VarInt int32

Minecraft Protocol VarInt type

func ReadVarInt

func ReadVarInt(r io.Reader) (VarInt, error)

ReadVarInt reads a VarInt encoded integer from the reader.

Jump to

Keyboard shortcuts

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