serialize

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MulanPSL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

serialize

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyMemory

func CopyMemory(src, dst []byte) int

func GetLengthDataLen

func GetLengthDataLen(avLen uint32) uint32

func GetValueDataPtr

func GetValueDataPtr(v *reflect.Value) uintptr

func Move

func Move(src, dst uintptr, size uint32)

func ReadLength

func ReadLength(bits []byte) (lengthValue uint32, readLen uint32)

func ReadString

func ReadString(bits []byte) (str string, readLen uint32)

func WiriteLength

func WiriteLength(bits []byte, aLength uint32) (wirteLen uint32)

func WriteString

func WriteString(bits []byte, str string) (writeLen uint32)

Types

type BufferUtils

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

func NewBufferUtils

func NewBufferUtils(buff []byte) *BufferUtils

func (*BufferUtils) GetWritePos

func (bw *BufferUtils) GetWritePos() uint32

func (*BufferUtils) ReadUint16

func (bw *BufferUtils) ReadUint16() (v uint16)

func (*BufferUtils) ReadUint32

func (bw *BufferUtils) ReadUint32() (v uint32)

func (*BufferUtils) ReadUint64

func (bw *BufferUtils) ReadUint64() (v uint64)

func (*BufferUtils) ReadUint8

func (bw *BufferUtils) ReadUint8() (v uint8)

func (*BufferUtils) ResetPos

func (bw *BufferUtils) ResetPos(newPos uint32) (r bool)

func (*BufferUtils) Write

func (bw *BufferUtils) Write(a any) bool

type HashIdType

type HashIdType = int32 // =, 用别名,方便兼容

type PByteArray

type PByteArray (*[cMaxArrSize]byte)

type PStrArray

type PStrArray (*[cMaxArrSize]string)

type Serializer

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

func New

func New(isLikeCStruct bool, hashTblSize int) *Serializer

方便线程和不同的模式使用 isLikeCStruct 主要是跟 c++、Delphi 类通讯

func (*Serializer) Decode

func (s *Serializer) Decode(bits []byte, ptr interface{}) bool

func (*Serializer) DecodeStruct

func (s *Serializer) DecodeStruct(id HashIdType, bits []byte) (obj interface{}, isOk bool)

func (*Serializer) Encode

func (s *Serializer) Encode(ptr interface{}) (result []byte, ok bool)

这里传指针,加快访问速度

func (*Serializer) NewStruct

func (s *Serializer) NewStruct(id HashIdType) interface{}

根据注册ID新建结构,方便外面使用

func (*Serializer) RegisterType

func (s *Serializer) RegisterType(id HashIdType, obj interface{}) bool

Jump to

Keyboard shortcuts

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