codec

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: BSD-3-Clause Imports: 6 Imported by: 85

Documentation

Index

Constants

View Source
const (
	BYTE byte = iota
	SHORT
	INT
	LONG
	FLOAT
	DOUBLE
	STRING1
	STRING4
	MAP
	LIST
	StructBegin
	StructEnd
	ZeroTag
	SimpleList
)

jce type

Variables

This section is empty.

Functions

func FromInt8

func FromInt8(vec []int8) []byte

FromInt8 NewReader(FromInt8(vec))

Types

type Buffer

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

Buffer is wrapper of bytes.Buffer

func NewBuffer

func NewBuffer(args ...*bytes.Buffer) *Buffer

NewBuffer returns *Buffer

func (*Buffer) Grow

func (b *Buffer) Grow(size int)

Grow grows the size of the buffer.

func (*Buffer) Len added in v1.2.0

func (b *Buffer) Len() int

func (*Buffer) Reset

func (b *Buffer) Reset()

Reset clean the buffer.

func (*Buffer) ToBytes

func (b *Buffer) ToBytes() []byte

ToBytes make the buffer to []byte

func (*Buffer) WriteBool added in v1.3.0

func (b *Buffer) WriteBool(data bool, tag byte) error

WriteBool write bool with the tag.

func (*Buffer) WriteBytes added in v1.3.0

func (b *Buffer) WriteBytes(data []byte) error

WriteBytes write []byte to the buffer

func (*Buffer) WriteFloat32 added in v1.3.0

func (b *Buffer) WriteFloat32(data float32, tag byte) error

WriteFloat32 writes float32 with the tag.

func (*Buffer) WriteFloat64 added in v1.3.0

func (b *Buffer) WriteFloat64(data float64, tag byte) error

WriteFloat64 writes float64 with the tag.

func (*Buffer) WriteHead

func (b *Buffer) WriteHead(ty byte, tag byte) error

func (*Buffer) WriteInt16 added in v1.3.0

func (b *Buffer) WriteInt16(data int16, tag byte) error

WriteInt16 write the int16 with the tag.

func (*Buffer) WriteInt32 added in v1.3.0

func (b *Buffer) WriteInt32(data int32, tag byte) error

WriteInt32 write int32 with the tag.

func (*Buffer) WriteInt64 added in v1.3.0

func (b *Buffer) WriteInt64(data int64, tag byte) error

WriteInt64 write int64 with the tag.

func (*Buffer) WriteInt8 added in v1.3.0

func (b *Buffer) WriteInt8(data int8, tag byte) error

WriteInt8 write int8 with the tag.

func (*Buffer) WriteSliceInt8 added in v1.3.0

func (b *Buffer) WriteSliceInt8(data []int8) error

WriteSliceInt8 write []int8 to the buffer.

func (*Buffer) WriteSliceUint8 added in v1.3.0

func (b *Buffer) WriteSliceUint8(data []uint8) error

WriteSliceUint8 write []uint8 to the buffer.

func (*Buffer) WriteString added in v1.3.0

func (b *Buffer) WriteString(data string, tag byte) error

WriteString writes string data with the tag.

func (*Buffer) WriteUint16 added in v1.3.0

func (b *Buffer) WriteUint16(data uint16, tag byte) error

WriteUint16 write uint16 with the tag.

func (*Buffer) WriteUint32 added in v1.3.0

func (b *Buffer) WriteUint32(data uint32, tag byte) error

WriteUint32 write uint32 data with the tag.

func (*Buffer) WriteUint8 added in v1.3.0

func (b *Buffer) WriteUint8(data uint8, tag byte) error

WriteUint8 write uint8 with the tag

type Reader

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

Reader is wrapper of bytes.Reader

func NewReader

func NewReader(data []byte) *Reader

NewReader returns *Reader

func (*Reader) Len added in v1.2.0

func (b *Reader) Len() int

func (*Reader) Next

func (b *Reader) Next(n int) []byte

Next return the []byte of next n .

func (*Reader) ReadBool added in v1.3.0

func (b *Reader) ReadBool(data *bool, tag byte, require bool) error

ReadBool reads the bool value for the tag and the require or optional sign.

func (*Reader) ReadBytes added in v1.3.0

func (b *Reader) ReadBytes(data *[]byte, len int32, require bool) error

ReadBytes reads []byte for the given length and the require or optional sign.

func (*Reader) ReadFloat32 added in v1.3.0

func (b *Reader) ReadFloat32(data *float32, tag byte, require bool) error

ReadFloat32 reads the float32 value for the tag and the require or optional sign.

func (*Reader) ReadFloat64 added in v1.3.0

func (b *Reader) ReadFloat64(data *float64, tag byte, require bool) error

ReadFloat64 reads the float64 value for the tag and the require or optional sign.

func (*Reader) ReadInt16 added in v1.3.0

func (b *Reader) ReadInt16(data *int16, tag byte, require bool) error

ReadInt16 reads the int16 value for the tag and the require or optional sign.

func (*Reader) ReadInt32 added in v1.3.0

func (b *Reader) ReadInt32(data *int32, tag byte, require bool) error

ReadInt32 reads the int32 value for the tag and the require or optional sign.

func (*Reader) ReadInt64 added in v1.3.0

func (b *Reader) ReadInt64(data *int64, tag byte, require bool) error

ReadInt64 reads the int64 value for the tag and the require or optional sign.

func (*Reader) ReadInt8 added in v1.3.0

func (b *Reader) ReadInt8(data *int8, tag byte, require bool) error

ReadInt8 reads the int8 data for the tag and the require or optional sign.

func (*Reader) ReadSliceInt8 added in v1.3.0

func (b *Reader) ReadSliceInt8(data *[]int8, len int32, require bool) error

ReadSliceInt8 reads []int8 for the given length and the require or optional sign.

func (*Reader) ReadSliceUint8 added in v1.3.0

func (b *Reader) ReadSliceUint8(data *[]uint8, len int32, require bool) error

ReadSliceUint8 reads []uint8 force the given length and the require or optional sign.

func (*Reader) ReadString added in v1.3.0

func (b *Reader) ReadString(data *string, tag byte, require bool) error

ReadString reads the string value for the tag and the require or optional sign.

func (*Reader) ReadUint16 added in v1.3.0

func (b *Reader) ReadUint16(data *uint16, tag byte, require bool) error

ReadUint16 reads the uint16 value for the tag and the require or optional sign.

func (*Reader) ReadUint32 added in v1.3.0

func (b *Reader) ReadUint32(data *uint32, tag byte, require bool) error

ReadUint32 reads the uint32 value for the tag and the require or optional sign.

func (*Reader) ReadUint8 added in v1.3.0

func (b *Reader) ReadUint8(data *uint8, tag byte, require bool) error

ReadUint8 reads the uint8 for the tag and the require or optional sign.

func (*Reader) Reset added in v1.1.4

func (b *Reader) Reset(data []byte)

Reset clean the Reader.

func (*Reader) Skip

func (b *Reader) Skip(n int)

Skip the next n byte.

func (*Reader) SkipTo

func (b *Reader) SkipTo(ty, tag byte, require bool) (bool, error)

SkipTo skip to the given tag.

func (*Reader) SkipToNoCheck

func (b *Reader) SkipToNoCheck(tag byte, require bool) (bool, byte, error)

SkipToNoCheck for skip to the none StructEnd tag.

func (*Reader) SkipToStructEnd

func (b *Reader) SkipToStructEnd() error

SkipToStructEnd for skip to the StructEnd tag.

func (*Reader) ToBytes added in v1.1.4

func (b *Reader) ToBytes() []byte

ToBytes make the reader to string

func (*Reader) ToString added in v1.1.4

func (b *Reader) ToString() string

ToString make the reader to string

Jump to

Keyboard shortcuts

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