pkg

package
v0.0.0-...-94cd62a Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToInt

func BytesToInt(b []byte) int

字节转换成整形

func DecodeFixed16

func DecodeFixed16(b []byte) uint16

func DecodeFixed32

func DecodeFixed32(b []byte) uint32

func DecodeFixed32BE

func DecodeFixed32BE(b []byte) uint32

func DecodeFixed64

func DecodeFixed64(b []byte) uint64

func DecodeFixed64BE

func DecodeFixed64BE(b []byte) uint64

func DecodeZigzag32

func DecodeZigzag32(value uint32) int32

func DecodeZigzag64

func DecodeZigzag64(value uint64) int64

func EncodeFixed16

func EncodeFixed16(value uint16) []byte

func EncodeFixed32

func EncodeFixed32(value uint32) []byte

func EncodeFixed32BE

func EncodeFixed32BE(value uint32) []byte

func EncodeFixed64

func EncodeFixed64(value uint64) []byte

func EncodeFixed64BE

func EncodeFixed64BE(value uint64) []byte

func EncodeVarint32

func EncodeVarint32(n uint32) []byte

func EncodeVarint64

func EncodeVarint64(n uint64) []byte

func EncodeZigzag32

func EncodeZigzag32(value int32) int32

func EncodeZigzag64

func EncodeZigzag64(value int64) int64

func GetVarint32Ptr

func GetVarint32Ptr(buffer []byte) (uint32, uint, error)

func GetVarint64Ptr

func GetVarint64Ptr(buffer []byte) (uint64, uint, error)

func IntToBytes

func IntToBytes(n int) []byte

整形转换成字节

func PutNByte

func PutNByte(order binary.ByteOrder, b []byte, v uint64)

func RandomBytes

func RandomBytes(len int, dst []byte) []byte

安全随机数

func Uint16ToBytes

func Uint16ToBytes(n uint16, order binary.ByteOrder) []byte

func Uint32ToBytes

func Uint32ToBytes(n uint32, order binary.ByteOrder) []byte

func Uint64ToBytes

func Uint64ToBytes(n uint64, order binary.ByteOrder) []byte

func VarintLength

func VarintLength(v uint64) int

Types

type LimitedPool

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

func NewLimitedPool

func NewLimitedPool(minSize, maxSize int) *LimitedPool

func (*LimitedPool) Get

func (p *LimitedPool) Get(size int) *[]byte

func (*LimitedPool) Put

func (p *LimitedPool) Put(b *[]byte)

type MemoryStream

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

func NewMemoryStream

func NewMemoryStream(order binary.ByteOrder) MemoryStream

func (*MemoryStream) Bytes

func (p *MemoryStream) Bytes() []byte

func (*MemoryStream) Len

func (p *MemoryStream) Len() uint

func (*MemoryStream) Read

func (p *MemoryStream) Read(len uint) ([]byte, error)

func (*MemoryStream) ReadInt32

func (p *MemoryStream) ReadInt32() (int32, error)

func (*MemoryStream) ReadInt64

func (p *MemoryStream) ReadInt64() (int64, error)

func (*MemoryStream) ReadString

func (p *MemoryStream) ReadString() (string, error)

func (*MemoryStream) Remains

func (p *MemoryStream) Remains() uint

func (*MemoryStream) Write

func (p *MemoryStream) Write(b []byte) error

func (*MemoryStream) WriteInt32

func (p *MemoryStream) WriteInt32(value int32) error

func (*MemoryStream) WriteInt64

func (p *MemoryStream) WriteInt64(value int64) error

func (*MemoryStream) WriteString

func (p *MemoryStream) WriteString(value string) error

type MemoryStreamv2

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

func NewMemoryStreamv2

func NewMemoryStreamv2() MemoryStreamv2

func (*MemoryStreamv2) Bytes

func (p *MemoryStreamv2) Bytes() []byte

func (*MemoryStreamv2) Len

func (p *MemoryStreamv2) Len() uint

func (*MemoryStreamv2) Read

func (p *MemoryStreamv2) Read(length uint) ([]byte, error)

func (*MemoryStreamv2) ReadInt32

func (p *MemoryStreamv2) ReadInt32() (int32, error)

func (*MemoryStreamv2) ReadInt64

func (p *MemoryStreamv2) ReadInt64() (int64, error)

func (*MemoryStreamv2) ReadString

func (p *MemoryStreamv2) ReadString() (string, error)

func (*MemoryStreamv2) ReadUInt32

func (p *MemoryStreamv2) ReadUInt32() (uint32, error)

func (*MemoryStreamv2) Remains

func (p *MemoryStreamv2) Remains() uint

func (*MemoryStreamv2) Write

func (p *MemoryStreamv2) Write(b []byte) error

func (*MemoryStreamv2) WriteInt32

func (p *MemoryStreamv2) WriteInt32(value int32)

func (*MemoryStreamv2) WriteInt64

func (p *MemoryStreamv2) WriteInt64(value int64)

func (*MemoryStreamv2) WriteString

func (p *MemoryStreamv2) WriteString(value string) error

func (*MemoryStreamv2) WriteUInt32

func (p *MemoryStreamv2) WriteUInt32(value uint32)

Jump to

Keyboard shortcuts

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