binary

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package binary 数据处理

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToString added in v1.2.5

func BytesToString(b []byte) string

BytesToString 没有内存开销的转换

func GBK2UTF8

func GBK2UTF8(s []byte) ([]byte, error)

GBK2UTF8 GBK 转 UTF-8

func NewWriterF added in v1.2.4

func NewWriterF(f func(writer *Writer)) []byte

NewWriterF ...

func OpenWriterF added in v1.2.4

func OpenWriterF(f func(*Writer)) (b []byte, cl func())

OpenWriterF must call func cl to close

func PutWriter added in v1.2.4

func PutWriter(w *Writer)

PutWriter 将 Writer 放回池中

func StringToBytes added in v1.2.5

func StringToBytes(s string) (b []byte)

StringToBytes 没有内存开销的转换

func UTF82GBK

func UTF82GBK(s []byte) ([]byte, error)

UTF82GBK UTF-8 转 GBK

Types

type Writer added in v1.2.4

type Writer bytes.Buffer

Writer 写入

func SelectWriter added in v1.2.4

func SelectWriter() *Writer

SelectWriter 从池中取出一个 Writer

func (*Writer) Bytes added in v1.2.4

func (w *Writer) Bytes() []byte

Bytes ...

func (*Writer) FillUInt16 added in v1.2.4

func (w *Writer) FillUInt16() (pos int)

FillUInt16 ...

func (*Writer) FillUInt32 added in v1.2.4

func (w *Writer) FillUInt32() (pos int)

FillUInt32 ...

func (*Writer) Grow added in v1.2.4

func (w *Writer) Grow(n int)

Grow ...

func (*Writer) Len added in v1.2.4

func (w *Writer) Len() int

Len ...

func (*Writer) Reset added in v1.2.4

func (w *Writer) Reset()

Reset ...

func (*Writer) String added in v1.2.4

func (w *Writer) String() string

String ...

func (*Writer) Write added in v1.2.4

func (w *Writer) Write(b []byte) (n int, err error)

Write ...

func (*Writer) WriteBool added in v1.2.4

func (w *Writer) WriteBool(b bool)

WriteBool ...

func (*Writer) WriteByte added in v1.2.4

func (w *Writer) WriteByte(b byte) error

WriteByte ...

func (*Writer) WriteHex added in v1.2.4

func (w *Writer) WriteHex(h string)

WriteHex ...

func (*Writer) WriteString added in v1.2.4

func (w *Writer) WriteString(v string)

WriteString ...

func (*Writer) WriteUInt16 added in v1.2.4

func (w *Writer) WriteUInt16(v uint16)

WriteUInt16 ...

func (*Writer) WriteUInt16At added in v1.2.4

func (w *Writer) WriteUInt16At(pos int, v uint16)

WriteUInt16At ...

func (*Writer) WriteUInt16LE added in v1.3.0

func (w *Writer) WriteUInt16LE(v uint16)

WriteUInt16LE ...

func (*Writer) WriteUInt32 added in v1.2.4

func (w *Writer) WriteUInt32(v uint32)

WriteUInt32 ...

func (*Writer) WriteUInt32At added in v1.2.4

func (w *Writer) WriteUInt32At(pos int, v uint32)

WriteUInt32At ...

func (*Writer) WriteUInt32LE added in v1.3.0

func (w *Writer) WriteUInt32LE(v uint32)

WriteUInt32LE ...

func (*Writer) WriteUInt64 added in v1.2.4

func (w *Writer) WriteUInt64(v uint64)

WriteUInt64 ...

func (*Writer) WriteUInt64LE added in v1.3.0

func (w *Writer) WriteUInt64LE(v uint64)

WriteUInt64LE ...

Jump to

Keyboard shortcuts

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