util

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LineBreak string

Functions

func BytesToInt

func BytesToInt(b []byte) int

字节(小端)转为整数

func Decode

func Decode(src []byte, label string) (string, error)

解码

func DecodeMust

func DecodeMust(src []byte, label string) string

func Encode

func Encode(str, label string) ([]byte, error)

编码

func EncodeMust

func EncodeMust(str, label string) []byte

func Info

func Info[T constraints.Integer](r io.Reader, size T, info string)

func LookupEnc

func LookupEnc(label string) encoding.Encoding

读取编码

func MsTimeTo

func MsTimeTo(t time.Time) []byte

func MsToTime

func MsToTime(stamp uint32) time.Time

func NewReader

func NewReader(r io.Reader) io.Reader

将 io.Reader 转换为 utf-8 编码

func PrintHex

func PrintHex(b []byte)

func Read

func Read(path string) (io.Reader, error)

读取文件,自动识别编码

func ReadIntN

func ReadIntN[T constraints.Integer](r io.Reader, size T) int

func ReadN

func ReadN[T constraints.Integer](r io.Reader, size T) []byte

读取指定数量字节

func ReadUint16

func ReadUint16(r io.Reader) uint16

读取小端 uint16

func ReadUint32

func ReadUint32(r io.Reader) uint32

读取小端 uint32

func To2Bytes

func To2Bytes[T constraints.Integer](i T) []byte

转换为长度为 2 的字节切片

func To4Bytes

func To4Bytes[T constraints.Integer](i T) []byte

转换为长度为 4 的字节切片

Types

This section is empty.

Jump to

Keyboard shortcuts

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