buffer

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: MulanPSL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INT8_SIZE     int32 = 1
	INT16_SIZE    int32 = 2
	INT32_SIZE    int32 = 4
	INT64_SIZE    int32 = 8
	STRING_PREFIX int32 = 2
	BYTES_PREFIX  int32 = 2
)

Variables

This section is empty.

Functions

func ByteToInt16

func ByteToInt16(buf []byte) (ret int16)

ByteToInt16 大端字节序字节数组转int16

func ByteToInt16LD added in v1.0.16

func ByteToInt16LD(buf []byte) (ret int16)

ByteToInt16LD 小端字节序字节数组转int16

func ByteToInt32

func ByteToInt32(buf []byte) (ret int32)

ByteToInt32 大端字节序字节数组转int32

func ByteToInt32LD added in v1.0.16

func ByteToInt32LD(buf []byte) (ret int32)

ByteToInt32LD 小端字节序字节数组转int32

func ByteToInt64

func ByteToInt64(buf []byte) (ret int64)

ByteToInt64 大端字节序字节数组转int64

func ByteToInt64LD added in v1.0.16

func ByteToInt64LD(buf []byte) (ret int64)

ByteToInt64LD 小端字节序字节数组转int64

func Int16ToByte

func Int16ToByte(v int16) (buf []byte)

Int16ToByte 大端字节序int16转字节数组

func Int16ToByteLD added in v1.0.16

func Int16ToByteLD(v int16) (buf []byte)

Int16ToByteLD 小端字节序int16转字节数组

func Int32ToByte

func Int32ToByte(v int32) (buf []byte)

Int32ToByte 大端字节序int32转字节数组

func Int32ToByteLD added in v1.0.16

func Int32ToByteLD(v int32) (buf []byte)

Int32ToByteLD 小端字节序int32转字节数组

func Int64ToByte

func Int64ToByte(v int64) (buf []byte)

Int64ToByte 大端字节序int64转字节数组

func Int64ToByteLD added in v1.0.16

func Int64ToByteLD(v int64) (buf []byte)

Int64ToByteLD 小端字节序int64转字节数组

func UInt16ToByte added in v1.0.17

func UInt16ToByte(v uint16) (buf []byte)

UInt16ToByte 大端字节序uint16转字节数组

func UInt16ToByteLD added in v1.0.16

func UInt16ToByteLD(v uint16) (buf []byte)

UInt16ToByteLD 小端字节序uint16转字节数组

Types

type Buffer added in v1.0.16

type Buffer interface {
	ReadInt8() int8
	ReadUInt8() uint8
	ReadInt8WithIndex(int32) int8
	ReadUInt8WithIndex(int32) uint8
	ReadInt16() int16
	ReadInt16WithIndex(int32) int16
	ReadInt32() int32
	ReadInt32WithIndex(int32) int32
	ReadInt64() int64
	ReadInt64WithIndex(int32) int64
	ReadBytes() []byte
	ReadBytesWithOutLength() []byte
	ReadBytesWithIndex(int32) []byte
	ReadString(size int32) string
	ReadStringWithIndex(int32, int32) string
	ReadStringWithoutSize() string
	ReadStringWithOutLength() string

	WriteInt8(v int8)
	WriteUInt8(v uint8)
	WriteInt8WithIndex(int32, int8)
	WriteUInt8WithIndex(int32, uint8)
	WriteInt16(v int16)
	WriteInt16WithIndex(int32, int16)
	WriteUInt16(v uint16)
	WriteInt32(v int32)
	WriteInt32WithIndex(int32, int32)
	WriteInt64(v int64)
	WriteInt64WithIndex(int32, int64)
	WriteBytes(v []byte)
	WriteBytesWithOutLength([]byte)
	WriteBytesWithIndex(int32, []byte)
	WriteString(size int32, v string)
	WriteStringWithoutSize(v string)
	WriteStringWithIndex(int32, string)
	ToBytes() []byte
	GetWriteIndex() int32
	GetReadIndex() int32
	GetContent() []byte
	GetBodyContent() []byte
}

func CreateBigEndianBuffer added in v1.0.16

func CreateBigEndianBuffer() Buffer

CreateBigEndianBuffer 创建大端序Buffer

func CreateBuffer added in v1.0.16

func CreateBuffer(byteOrder ByteOrder) Buffer

CreateBuffer 指定字节序创建Buffer

func CreateLittleEndianBuffer added in v1.0.16

func CreateLittleEndianBuffer() Buffer

CreateLittleEndianBuffer 创建小端序Buffer

func FromBytes

func FromBytes(v []byte, byteOrder ByteOrder) Buffer

type ByteOrder added in v1.0.16

type ByteOrder int8
const (
	ByteOrderBigEndian    ByteOrder = 0
	ByteOrderLittleEndian ByteOrder = 1
)

Jump to

Keyboard shortcuts

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