enc

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 4 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

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

A Encoder calculates and writes the required byte size.

func NewEncoder

func NewEncoder() *Encoder

NewEncoder creates a new Encoder for serialization.

func (*Encoder) CalcBool

func (e *Encoder) CalcBool(v bool) int

CalcBool returns data size that need.

func (*Encoder) CalcByte

func (e *Encoder) CalcByte(b byte) int

CalcByte returns data size that need.

func (*Encoder) CalcComplex128

func (e *Encoder) CalcComplex128(v complex128) int

CalcComplex128 returns data size that need.

func (*Encoder) CalcComplex64

func (e *Encoder) CalcComplex64(v complex64) int

CalcComplex64 returns data size that need.

func (*Encoder) CalcFloat32

func (e *Encoder) CalcFloat32(v float32) int

CalcFloat32 returns data size that need.

func (*Encoder) CalcFloat64

func (e *Encoder) CalcFloat64(v float64) int

CalcFloat64 returns data size that need.

func (*Encoder) CalcInt

func (e *Encoder) CalcInt(v int) int

CalcInt checks value and returns data size that need.

func (*Encoder) CalcInt16

func (e *Encoder) CalcInt16(v int16) int

CalcInt16 checks value and returns data size that need.

func (*Encoder) CalcInt32

func (e *Encoder) CalcInt32(v int32) int

CalcInt32 checks value and returns data size that need.

func (*Encoder) CalcInt64

func (e *Encoder) CalcInt64(v int64) int

CalcInt64 checks value and returns data size that need.

func (*Encoder) CalcInt8

func (e *Encoder) CalcInt8(v int8) int

CalcInt8 checks value and returns data size that need.

func (*Encoder) CalcMapLength

func (e *Encoder) CalcMapLength(l int) (int, error)

CalcMapLength checks value and returns data size that need.

func (*Encoder) CalcNil

func (e *Encoder) CalcNil() int

CalcNil returns data size that need.

func (*Encoder) CalcRune

func (e *Encoder) CalcRune(v rune) int

CalcRune check value and returns data size that need.

func (*Encoder) CalcSliceLength

func (e *Encoder) CalcSliceLength(l int, isChildTypeByte bool) (int, error)

CalcSliceLength checks values and returns data size that need.

func (*Encoder) CalcString

func (e *Encoder) CalcString(v string) int

CalcString check value and returns data size that need.

func (*Encoder) CalcString16

func (e *Encoder) CalcString16(length int) int

CalcString16 returns data size that need.

func (*Encoder) CalcString32

func (e *Encoder) CalcString32(length int) int

CalcString32 returns data size that need.

func (*Encoder) CalcString8

func (e *Encoder) CalcString8(length int) int

CalcString8 returns data size that need.

func (*Encoder) CalcStringFix

func (e *Encoder) CalcStringFix(length int) int

CalcStringFix returns data size that need.

func (*Encoder) CalcStructHeader16

func (e *Encoder) CalcStructHeader16(fieldNum int) int

CalcStructHeader16 returns data size that need.

func (*Encoder) CalcStructHeader32

func (e *Encoder) CalcStructHeader32(fieldNum int) int

CalcStructHeader32 returns data size that need.

func (*Encoder) CalcStructHeaderFix

func (e *Encoder) CalcStructHeaderFix(fieldNum int) int

CalcStructHeaderFix returns data size that need.

func (*Encoder) CalcTime

func (e *Encoder) CalcTime(t time.Time) int

CalcTime check value and returns data size that need.

func (*Encoder) CalcUint

func (e *Encoder) CalcUint(v uint) int

CalcUint check value and returns data size that need.

func (*Encoder) CalcUint16

func (e *Encoder) CalcUint16(v uint16) int

CalcUint16 check value and returns data size that need.

func (*Encoder) CalcUint32

func (e *Encoder) CalcUint32(v uint32) int

CalcUint32 check value and returns data size that need.

func (*Encoder) CalcUint64

func (e *Encoder) CalcUint64(v uint64) int

CalcUint64 check value and returns data size that need.

func (*Encoder) CalcUint8

func (e *Encoder) CalcUint8(v uint8) int

CalcUint8 check value and returns data size that need.

func (*Encoder) EncodedBytes

func (e *Encoder) EncodedBytes() []byte

EncodedBytes gets encoded bytes.

func (*Encoder) MakeBytes

func (e *Encoder) MakeBytes(size int)

MakeBytes reserves the required byte array

func (*Encoder) WriteBool

func (e *Encoder) WriteBool(v bool, offset int) int

WriteBool sets the contents of v to the buffer.

func (*Encoder) WriteByte

func (e *Encoder) WriteByte(b byte, offset int) int

WriteByte sets the contents of v to the buffer.

func (*Encoder) WriteComplex128

func (e *Encoder) WriteComplex128(v complex128, offset int) int

WriteComplex128 sets the contents of v to the buffer.

func (*Encoder) WriteComplex64

func (e *Encoder) WriteComplex64(v complex64, offset int) int

WriteComplex64 sets the contents of v to the buffer.

func (*Encoder) WriteFloat32

func (e *Encoder) WriteFloat32(v float32, offset int) int

WriteFloat32 sets the contents of v to the buffer.

func (*Encoder) WriteFloat64

func (e *Encoder) WriteFloat64(v float64, offset int) int

WriteFloat64 sets the contents of v to the buffer.

func (*Encoder) WriteInt

func (e *Encoder) WriteInt(v int, offset int) int

WriteInt sets the contents of v to the buffer.

func (*Encoder) WriteInt16

func (e *Encoder) WriteInt16(v int16, offset int) int

WriteInt16 sets the contents of v to the buffer.

func (*Encoder) WriteInt32

func (e *Encoder) WriteInt32(v int32, offset int) int

WriteInt32 sets the contents of v to the buffer.

func (*Encoder) WriteInt64

func (e *Encoder) WriteInt64(v int64, offset int) int

WriteInt64 sets the contents of v to the buffer.

func (*Encoder) WriteInt8

func (e *Encoder) WriteInt8(v int8, offset int) int

WriteInt8 sets the contents of v to the buffer.

func (*Encoder) WriteMapLength

func (e *Encoder) WriteMapLength(l int, offset int) int

WriteMapLength sets the contents of l to the buffer.

func (*Encoder) WriteNil

func (e *Encoder) WriteNil(offset int) int

WriteNil sets the contents of v to the buffer.

func (*Encoder) WriteRune

func (e *Encoder) WriteRune(v rune, offset int) int

WriteRune sets the contents of v to the buffer.

func (*Encoder) WriteSliceLength

func (e *Encoder) WriteSliceLength(l int, offset int, isChildTypeByte bool) int

WriteSliceLength sets the contents of l to the buffer.

func (*Encoder) WriteString

func (e *Encoder) WriteString(str string, offset int) int

WriteString sets the contents of str to the buffer.

func (*Encoder) WriteString16

func (e *Encoder) WriteString16(str string, length, offset int) int

WriteString16 sets the contents of str to the buffer.

func (*Encoder) WriteString32

func (e *Encoder) WriteString32(str string, length, offset int) int

WriteString32 sets the contents of str to the buffer.

func (*Encoder) WriteString8

func (e *Encoder) WriteString8(str string, length, offset int) int

WriteString8 sets the contents of str to the buffer.

func (*Encoder) WriteStringFix

func (e *Encoder) WriteStringFix(str string, length, offset int) int

WriteStringFix sets the contents of str to the buffer.

func (*Encoder) WriteStructHeader16AsArray

func (e *Encoder) WriteStructHeader16AsArray(fieldNum, offset int) int

WriteStructHeader16AsArray sets num of fields to the buffer as array type.

func (*Encoder) WriteStructHeader16AsMap

func (e *Encoder) WriteStructHeader16AsMap(fieldNum, offset int) int

WriteStructHeader16AsMap sets num of fields to the buffer as map type.

func (*Encoder) WriteStructHeader32AsArray

func (e *Encoder) WriteStructHeader32AsArray(fieldNum, offset int) int

WriteStructHeader32AsArray sets num of fields to the buffer as array type.

func (*Encoder) WriteStructHeader32AsMap

func (e *Encoder) WriteStructHeader32AsMap(fieldNum, offset int) int

WriteStructHeader32AsMap sets num of fields to the buffer as map type.

func (*Encoder) WriteStructHeaderFixAsArray

func (e *Encoder) WriteStructHeaderFixAsArray(fieldNum, offset int) int

WriteStructHeaderFixAsArray sets num of fields to the buffer as array type.

func (*Encoder) WriteStructHeaderFixAsMap

func (e *Encoder) WriteStructHeaderFixAsMap(fieldNum, offset int) int

WriteStructHeaderFixAsMap sets num of fields to the buffer as map type.

func (*Encoder) WriteTime

func (e *Encoder) WriteTime(t time.Time, offset int) int

WriteTime sets the contents of t to the buffer.

func (*Encoder) WriteUint

func (e *Encoder) WriteUint(v uint, offset int) int

WriteUint sets the contents of v to the buffer.

func (*Encoder) WriteUint16

func (e *Encoder) WriteUint16(v uint16, offset int) int

WriteUint16 sets the contents of v to the buffer.

func (*Encoder) WriteUint32

func (e *Encoder) WriteUint32(v uint32, offset int) int

WriteUint32 sets the contents of v to the buffer.

func (*Encoder) WriteUint64

func (e *Encoder) WriteUint64(v uint64, offset int) int

WriteUint64 sets the contents of v to the buffer.

func (*Encoder) WriteUint8

func (e *Encoder) WriteUint8(v uint8, offset int) int

WriteUint8 sets the contents of v to the buffer.

Jump to

Keyboard shortcuts

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