Documentation ¶
Overview ¶
二进制及byte操作
Index ¶
- func Decode(b []byte, vs ...interface{}) error
- func DecodeBits(bits []Bit) int
- func DecodeBitsToUint(bits []Bit) uint
- func DecodeToBool(b []byte) bool
- func DecodeToFloat32(b []byte) float32
- func DecodeToFloat64(b []byte) float64
- func DecodeToInt(b []byte) int
- func DecodeToInt16(b []byte) int16
- func DecodeToInt32(b []byte) int32
- func DecodeToInt64(b []byte) int64
- func DecodeToInt8(b []byte) int8
- func DecodeToString(b []byte) string
- func DecodeToUint(b []byte) uint
- func DecodeToUint16(b []byte) uint16
- func DecodeToUint32(b []byte) uint32
- func DecodeToUint64(b []byte) uint64
- func DecodeToUint8(b []byte) uint8
- func Encode(vs ...interface{}) []byte
- func EncodeBitsToBytes(bits []Bit) []byte
- func EncodeBool(b bool) []byte
- func EncodeFloat32(f float32) []byte
- func EncodeFloat64(f float64) []byte
- func EncodeInt(i int) []byte
- func EncodeInt16(i int16) []byte
- func EncodeInt32(i int32) []byte
- func EncodeInt64(i int64) []byte
- func EncodeInt8(i int8) []byte
- func EncodeString(s string) []byte
- func EncodeUint(i uint) []byte
- func EncodeUint16(i uint16) []byte
- func EncodeUint32(i uint32) []byte
- func EncodeUint64(i uint64) []byte
- func EncodeUint8(i uint8) []byte
- type Bit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
整形二进制解包,注意第二个及其后参数为字长确定的整形变量的指针地址,以便确定解析的[]byte长度, 例如:int8/16/32/64、uint8/16/32/64、float32/64等等
func DecodeToFloat32 ¶
func DecodeToFloat64 ¶
func DecodeToInt16 ¶
func DecodeToInt32 ¶
func DecodeToInt64 ¶
func DecodeToInt8 ¶
func DecodeToString ¶
func DecodeToUint16 ¶
func DecodeToUint32 ¶
func DecodeToUint64 ¶
func DecodeToUint8 ¶
func Encode ¶
func Encode(vs ...interface{}) []byte
针对基本类型进行二进制打包,支持的基本数据类型包括:int/8/16/32/64、uint/8/16/32/64、float32/64、bool、string、[]byte 其他未知类型使用 fmt.Sprintf("%v", value) 转换为字符串之后处理
func EncodeBitsToBytes ¶
将bits转换为[]byte,从左至右进行编码,不足1 byte按0往末尾补充
func EncodeBool ¶
func EncodeFloat32 ¶
func EncodeFloat64 ¶
func EncodeInt16 ¶
func EncodeInt32 ¶
func EncodeInt64 ¶
func EncodeInt8 ¶
func EncodeString ¶
func EncodeUint16 ¶
func EncodeUint32 ¶
func EncodeUint64 ¶
func EncodeUint8 ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.