serialization

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: LGPL-3.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEof = errors.New("got EOF, can not get the next byte")
View Source
var ErrRange = errors.New("value out of range")

Functions

func GetVarUintSize

func GetVarUintSize(value uint64) int

func ReadBool

func ReadBool(reader io.Reader) (bool, error)

func ReadByte

func ReadByte(reader io.Reader) (byte, error)

func ReadBytes

func ReadBytes(reader io.Reader, length uint64) ([]byte, error)

func ReadString

func ReadString(reader io.Reader) (string, error)

func ReadUint16

func ReadUint16(reader io.Reader) (uint16, error)

func ReadUint32

func ReadUint32(reader io.Reader) (uint32, error)

func ReadUint64

func ReadUint64(reader io.Reader) (uint64, error)

func ReadUint8

func ReadUint8(reader io.Reader) (uint8, error)

func ReadVarBytes

func ReadVarBytes(reader io.Reader) ([]byte, error)

func ReadVarUint

func ReadVarUint(reader io.Reader, maxint uint64) (uint64, error)

func WriteBool

func WriteBool(writer io.Writer, val bool) error

func WriteByte

func WriteByte(writer io.Writer, val byte) error

func WriteString

func WriteString(writer io.Writer, value string) error

func WriteUint16

func WriteUint16(writer io.Writer, val uint16) error

func WriteUint32

func WriteUint32(writer io.Writer, val uint32) error

func WriteUint64

func WriteUint64(writer io.Writer, val uint64) error

func WriteUint8

func WriteUint8(writer io.Writer, val uint8) error

func WriteVarBytes

func WriteVarBytes(writer io.Writer, value []byte) error

func WriteVarUint

func WriteVarUint(writer io.Writer, value uint64) error

Types

type SerializableData

type SerializableData interface {
	// Write data to writer
	Serialize(w io.Writer) error

	// read data to reader
	Deserialize(r io.Reader) error
}

SerializableData describe the data need be serialized.

Jump to

Keyboard shortcuts

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