codec

package
v1.6.65 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

reference: https://github.com/stoklund/varint/blob/master/prefix_varint.cpp

reference github.com/golang/protobuf/proto encode.go decode.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PseudoCloneSimpleEncoder

func PseudoCloneSimpleEncoder(encoder *SimpleEncoder)

func ReleaseSimpleEncoder

func ReleaseSimpleEncoder(encoder *SimpleEncoder)

Types

type PBCodec

type PBCodec interface {
	Size() int
	MarshalTo([]byte) (int, error)
	Unmarshal([]byte) error
}

type SimpleDecoder

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

simple decoder

func (*SimpleDecoder) Bytes

func (d *SimpleDecoder) Bytes() []byte

func (*SimpleDecoder) DecodeVarint

func (d *SimpleDecoder) DecodeVarint() uint64

func (*SimpleDecoder) Failed

func (d *SimpleDecoder) Failed() bool

func (*SimpleDecoder) Init

func (d *SimpleDecoder) Init(buf []byte)

func (*SimpleDecoder) IsEnd

func (d *SimpleDecoder) IsEnd() bool

func (*SimpleDecoder) Offset

func (d *SimpleDecoder) Offset() int

func (*SimpleDecoder) ReadBool

func (d *SimpleDecoder) ReadBool() bool

func (*SimpleDecoder) ReadBytes

func (d *SimpleDecoder) ReadBytes() []byte

func (*SimpleDecoder) ReadBytesN

func (d *SimpleDecoder) ReadBytesN(n int) []byte

func (*SimpleDecoder) ReadBytesWithVarintLen

func (d *SimpleDecoder) ReadBytesWithVarintLen() []byte

func (*SimpleDecoder) ReadIPv4

func (d *SimpleDecoder) ReadIPv4(v net.IP)

func (*SimpleDecoder) ReadIPv6

func (d *SimpleDecoder) ReadIPv6(v []byte)

func (*SimpleDecoder) ReadPB

func (d *SimpleDecoder) ReadPB(pb PBCodec) error

func (*SimpleDecoder) ReadPrefixU64

func (d *SimpleDecoder) ReadPrefixU64() uint64

func (*SimpleDecoder) ReadString255

func (d *SimpleDecoder) ReadString255() string

func (*SimpleDecoder) ReadU16

func (d *SimpleDecoder) ReadU16() uint16

func (*SimpleDecoder) ReadU16Slice

func (d *SimpleDecoder) ReadU16Slice() []uint16

func (*SimpleDecoder) ReadU32

func (d *SimpleDecoder) ReadU32() uint32

func (*SimpleDecoder) ReadU32Slice

func (d *SimpleDecoder) ReadU32Slice() []uint32

func (*SimpleDecoder) ReadU64

func (d *SimpleDecoder) ReadU64() uint64

func (*SimpleDecoder) ReadU8

func (d *SimpleDecoder) ReadU8() byte

func (*SimpleDecoder) ReadVarintU32

func (d *SimpleDecoder) ReadVarintU32() uint32

func (*SimpleDecoder) ReadVarintU64

func (d *SimpleDecoder) ReadVarintU64() uint64

func (*SimpleDecoder) ReadZigzagU32

func (d *SimpleDecoder) ReadZigzagU32() uint32

decode

func (*SimpleDecoder) ReadZigzagU64

func (d *SimpleDecoder) ReadZigzagU64() uint64

func (*SimpleDecoder) String

func (d *SimpleDecoder) String() string

type SimpleEncoder

type SimpleEncoder struct {
	pool.ReferenceCount
	// contains filtered or unexported fields
}

buffered encoder

func AcquireSimpleEncoder

func AcquireSimpleEncoder() *SimpleEncoder

func (*SimpleEncoder) Bytes

func (e *SimpleEncoder) Bytes() []byte

func (*SimpleEncoder) Init

func (d *SimpleEncoder) Init(buf []byte)

func (*SimpleEncoder) RefOfString

func (e *SimpleEncoder) RefOfString() string

func (*SimpleEncoder) ReplaceU16At

func (e *SimpleEncoder) ReplaceU16At(offset int, v uint16)

func (*SimpleEncoder) ReplaceU32At

func (e *SimpleEncoder) ReplaceU32At(offset int, v uint32)

func (*SimpleEncoder) ReplaceU64At

func (e *SimpleEncoder) ReplaceU64At(offset int, v uint64)

func (*SimpleEncoder) Reset

func (e *SimpleEncoder) Reset()

func (*SimpleEncoder) String

func (e *SimpleEncoder) String() string

func (*SimpleEncoder) WriteBigEndianU16

func (e *SimpleEncoder) WriteBigEndianU16(v uint16)

func (*SimpleEncoder) WriteBigEndianU32

func (e *SimpleEncoder) WriteBigEndianU32(v uint32)

func (*SimpleEncoder) WriteBool

func (e *SimpleEncoder) WriteBool(v bool)

func (*SimpleEncoder) WriteBytes

func (e *SimpleEncoder) WriteBytes(v []byte)

func (*SimpleEncoder) WriteBytesWithVarintLen

func (e *SimpleEncoder) WriteBytesWithVarintLen(v []byte)

func (*SimpleEncoder) WriteIPv6

func (e *SimpleEncoder) WriteIPv6(v []byte)

func (*SimpleEncoder) WritePB

func (e *SimpleEncoder) WritePB(v PBCodec)

func (*SimpleEncoder) WritePrefixU64

func (e *SimpleEncoder) WritePrefixU64(x uint64)

func (*SimpleEncoder) WriteRawString

func (e *SimpleEncoder) WriteRawString(v string)

func (*SimpleEncoder) WriteString255

func (e *SimpleEncoder) WriteString255(v string)

注意:将会截断至255字节

func (*SimpleEncoder) WriteU16

func (e *SimpleEncoder) WriteU16(v uint16)

func (*SimpleEncoder) WriteU16Slice

func (e *SimpleEncoder) WriteU16Slice(vs []uint16)

func (*SimpleEncoder) WriteU32

func (e *SimpleEncoder) WriteU32(v uint32)

func (*SimpleEncoder) WriteU32Slice

func (e *SimpleEncoder) WriteU32Slice(vs []uint32)

func (*SimpleEncoder) WriteU64

func (e *SimpleEncoder) WriteU64(v uint64)

func (*SimpleEncoder) WriteU8

func (e *SimpleEncoder) WriteU8(v byte)

func (*SimpleEncoder) WriteVarintU32

func (e *SimpleEncoder) WriteVarintU32(v uint32)

func (*SimpleEncoder) WriteVarintU64

func (e *SimpleEncoder) WriteVarintU64(v uint64)

func (*SimpleEncoder) WriteZigzagU32

func (e *SimpleEncoder) WriteZigzagU32(v uint32)

func (*SimpleEncoder) WriteZigzagU64

func (e *SimpleEncoder) WriteZigzagU64(v uint64)

Jump to

Keyboard shortcuts

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