transfer

package
v0.0.0-...-82269be Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxLength = uint32(1024 * 1024 * 20)

默认最大长度20M

Variables

This section is empty.

Functions

func ByteArrayNoZeroString

func ByteArrayNoZeroString(arr []byte) (rst string)

定长数组去掉多余的0后转字符串,先将定长数组转为切片后传入

func Gb2312ToUtf

func Gb2312ToUtf(text []byte) (result []byte, err error)

GB2312转换为UTF-8

func GbkToUtf

func GbkToUtf(text []byte) (result []byte, err error)

GBK转换为UTF-8

func ReadBigEndian

func ReadBigEndian(content []byte, target interface{}) (err error)

按大端序解析[]byte到结构体

func ReadConn

func ReadConn(
	conn net.Conn,
	length uint32,
) (buf []byte, err error)

从连接中读取数据,不判断最大长度

func ReadConnMaxLength

func ReadConnMaxLength(
	conn net.Conn,
	length uint32,
	maxLength uint32,
) (buf []byte, err error)

从连接中读取数据,判断最大长度

func ReadLittleEndian

func ReadLittleEndian(content []byte, target interface{}) (err error)

按小端序解析[]byte到结构体

func UtfToGb2312

func UtfToGb2312(text []byte) (result []byte, err error)

UTF-8转换为GB2312

func UtfToGbk

func UtfToGbk(text []byte) (result []byte, err error)

UTF-8转换为GBK

func WriteBigEndian

func WriteBigEndian(content interface{}) (result []byte, err error)

将数据转换为大端序

func WriteLittleEndian

func WriteLittleEndian(content interface{}) (result []byte, err error)

将数据转换为小端序

Types

This section is empty.

Jump to

Keyboard shortcuts

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