jex

package
v0.0.0-...-692212b Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(w io.Writer, in interface{}, zip bool) error

写标准Jex文件 标准的Jex格式需要有文件头, 以识别是否压缩. 此外, 标准的Jex只有一个根节点, 其它内容需要放到根节点下.

func MarshalNaked

func MarshalNaked(w io.Writer, in interface{}, name string) error

写裸数据. name 可以为空

func ReadByte

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

辅助函数, 读取一个字节

func ReadBytes

func ReadBytes(r io.Reader) ([]byte, error)

func ReadHeader

func ReadHeader(r io.Reader) (ver int, zip bool, err error)

读文件头

func ReadString

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

辅助函数, 读取一个字符串

func ReadUvarint

func ReadUvarint(r io.Reader) (uint64, error)

辅助函数, 读取一个变长整数

func ReadVarint

func ReadVarint(r io.Reader) (int64, error)

辅助函数, 读取一个变长整数

func Unmarshal

func Unmarshal(r io.Reader, out interface{}) error

func UnmarshalNaked

func UnmarshalNaked(r io.Reader, out interface{}) (name string, err error)

读裸数据

func WriteByte

func WriteByte(w io.Writer, c byte) error

辅助函数, 写入一个字节

func WriteBytes

func WriteBytes(w io.Writer, s []byte) error

辅助函数, 写入一段二进制数据

func WriteHeader

func WriteHeader(w io.Writer, zip bool) error

写文件头

func WriteString

func WriteString(w io.Writer, s string) error

辅助函数, 写入一个字符串

func WriteUvarint

func WriteUvarint(w io.Writer, x uint64) error

辅助函数, 写入一个变长整数

func WriteVarint

func WriteVarint(w io.Writer, x int64) error

辅助函数, 写入一个变长整数

Types

type InvalidUnmarshalError

type InvalidUnmarshalError struct {
	Type reflect.Type
}

func (*InvalidUnmarshalError) Error

func (e *InvalidUnmarshalError) Error() string

type Jex

type Jex struct {
	Any      interface{}
	Children []*Jex
	Index    map[string]*Jex
}

type Marshaler

type Marshaler interface {
	MarshalJex(w io.Writer) error
}

供对象实现的接口, 用自己的方法写入Jex数据块 Jex数据块要求

type Unmarshaler

type Unmarshaler interface {
	UnmarshalJex(r io.Reader) error
}

供对象实现的接口, 用自己的方法读取Jex数据块

Jump to

Keyboard shortcuts

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