Documentation
¶
Index ¶
- Constants
- Variables
- func AppendVarint(b []byte, v uint64) ([]byte, int)
- func BitGet(frame byte, position int) byte
- func BitSet0(frame *byte, position int)
- func BitSet1(frame *byte, position int)
- func Bytes2Hex(d []byte) string
- func Bytes2Int(b []byte) int
- func Bytes2IntBigEndian(b []byte) (int, error)
- func Bytes2IntByOrder(b []byte, order binary.ByteOrder) int
- func Bytes2IntLittleEndian(b []byte) (int, error)
- func Bytes2String(frame []byte) string
- func Bytes2StringByCharset(byte []byte, charset Charset) string
- func Bytes2UIntBigEndian(b []byte) (int, error)
- func Bytes2UIntLittleEndian(b []byte) (int, error)
- func CheckSum(data []byte) uint16
- func CheckSum2Byte(data []byte, order binary.ByteOrder) []byte
- func CopyBytes(b []byte) (copiedBytes []byte)
- func FromHex(s string) []byte
- func Hex2Bytes(str string) []byte
- func Hex2BytesFixed(str string, flen int) []byte
- func Int2Byte(n int) byte
- func Int2Byte2(curr int) []byte
- func Int2Bytes(n int) []byte
- func Int2BytesBigEndian(n int64, bytesLength byte) ([]byte, error)
- func Int2BytesByOrder(n int, order binary.ByteOrder) []byte
- func Int2BytesLittleEndian(n int64, bytesLength byte) ([]byte, error)
- func Join(prefix, context []byte) []byte
- func LeftPadBytes(slice []byte, l int) []byte
- func Poll2Byte(frame *[]byte) int16
- func Poll4Byte(frame *[]byte) int32
- func RightPadBytes(slice []byte, l int) []byte
- func ShowBin(a byte) string
- func TrimLeftZeroes(s []byte) []byte
- func TrimRightZeroes(s []byte) []byte
- type Charset
Constants ¶
View Source
const ( UTF8 = Charset("UTF-8") GB18030 = Charset("GB18030") )
Variables ¶
View Source
var MbTable = []uint16{}/* 256 elements not displayed */
Functions ¶
func Bytes2IntBigEndian ¶
Bytes2IntBigEndian (大端) []byte 转 int
func Bytes2IntLittleEndian ¶
Bytes2IntLittleEndian 小端[]byte 转 int
func Bytes2String ¶
func Bytes2StringByCharset ¶
func Bytes2UIntBigEndian ¶
Bytes2UIntBigEndian (大端) []byte 转 uint
func Bytes2UIntLittleEndian ¶
Bytes2UIntLittleEndian (小端) []byte 转 uint
func FromHex ¶
FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".
func Hex2BytesFixed ¶
Hex2BytesFixed returns bytes of a specified fixed length flen.
func Int2BytesBigEndian ¶
Int2BytesBigEndian int 转大端 []byte
func Int2BytesLittleEndian ¶
Int2BytesLittleEndian int 转小端 []byte
func LeftPadBytes ¶
LeftPadBytes zero-pads slice to the left up to length l.
func RightPadBytes ¶
RightPadBytes zero-pads slice to the right up to length l.
func TrimLeftZeroes ¶
TrimLeftZeroes returns a subslice of s without leading zeroes
func TrimRightZeroes ¶
TrimRightZeroes returns a subslice of s without trailing zeroes
Types ¶
Click to show internal directories.
Click to hide internal directories.