packer

package
v0.0.0-...-bee29bd Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: BSD-2-Clause Imports: 3 Imported by: 6

Documentation

Index

Constants

View Source
const (
	Sanitize                = 1
	SanitizeCC              = 2
	SanitizeSkipWhitespaces = 4
)

Variables

This section is empty.

Functions

func PackBool

func PackBool(b bool) []byte

func PackInt

func PackInt(num int) []byte

func PackStr

func PackStr(str string) []byte

func UnpackInt

func UnpackInt(data []byte) int

func UnpackMsgAndSys

func UnpackMsgAndSys(data []byte) (msgId int, system bool)

Types

type Unpacker

type Unpacker struct {
	// contains filtered or unexported fields
}

func (*Unpacker) Data

func (u *Unpacker) Data() []byte

get the full payload from the very beginning

see also: - Rest() - RemainingData()

func (*Unpacker) GetByte

func (u *Unpacker) GetByte() (byte, error)

consume one byte

func (*Unpacker) GetInt

func (u *Unpacker) GetInt() int

func (*Unpacker) GetMsgAndSys

func (u *Unpacker) GetMsgAndSys() (msgId int, system bool, err error)

func (*Unpacker) GetRaw

func (u *Unpacker) GetRaw(size int) ([]byte, error)

func (*Unpacker) GetString

func (u *Unpacker) GetString() (string, error)

func (*Unpacker) GetStringSanitized

func (u *Unpacker) GetStringSanitized(sanitizeType int) (string, error)

func (*Unpacker) RemainingData

func (u *Unpacker) RemainingData() []byte

read only operation does not consume the data if you need to consume the data use Rest() instead this method is mostly used for debugging

see also: - Rest() - Data()

func (*Unpacker) RemainingSize

func (u *Unpacker) RemainingSize() int

func (*Unpacker) Reset

func (u *Unpacker) Reset(data []byte)

func (*Unpacker) Rest

func (u *Unpacker) Rest() []byte

consume raw data until the end

see also: - Data() - RemainingData()

func (*Unpacker) Size

func (u *Unpacker) Size() int

Jump to

Keyboard shortcuts

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