binary

package
v0.0.0-...-78a83f1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: GPL-3.0 Imports: 9 Imported by: 104

Documentation

Overview

Package binary 数据处理

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToString

func BytesToString(b []byte) string

BytesToString 没有内存开销的转换

func GBK2UTF8

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

GBK2UTF8 GBK 转 UTF-8

func NewWriterF

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

NewWriterF ...

func OpenWriterF

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

OpenWriterF must call func cl to close

func PutWriter

func PutWriter(w *Writer)

PutWriter 将 Writer 放回池中

func StringToBytes

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

StringToBytes 没有内存开销的转换

func UTF82GBK

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

UTF82GBK UTF-8 转 GBK

Types

type Writer

type Writer bytes.Buffer

Writer 写入

func SelectWriter

func SelectWriter() *Writer

SelectWriter 从池中取出一个 Writer

func (*Writer) Bytes

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

Bytes ...

func (*Writer) FillUInt16

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

FillUInt16 ...

func (*Writer) FillUInt32

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

FillUInt32 ...

func (*Writer) Grow

func (w *Writer) Grow(n int)

Grow ...

func (*Writer) Len

func (w *Writer) Len() int

Len ...

func (*Writer) Reset

func (w *Writer) Reset()

Reset ...

func (*Writer) String

func (w *Writer) String() string

String ...

func (*Writer) Write

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

Write ...

func (*Writer) WriteBool

func (w *Writer) WriteBool(b bool)

WriteBool ...

func (*Writer) WriteByte

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

WriteByte ...

func (*Writer) WriteHex

func (w *Writer) WriteHex(h string)

WriteHex ...

func (*Writer) WriteString

func (w *Writer) WriteString(v string)

WriteString ...

func (*Writer) WriteUInt16

func (w *Writer) WriteUInt16(v uint16)

WriteUInt16 ...

func (*Writer) WriteUInt16At

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

WriteUInt16At ...

func (*Writer) WriteUInt16LE

func (w *Writer) WriteUInt16LE(v uint16)

WriteUInt16LE ...

func (*Writer) WriteUInt32

func (w *Writer) WriteUInt32(v uint32)

WriteUInt32 ...

func (*Writer) WriteUInt32At

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

WriteUInt32At ...

func (*Writer) WriteUInt32LE

func (w *Writer) WriteUInt32LE(v uint32)

WriteUInt32LE ...

func (*Writer) WriteUInt64

func (w *Writer) WriteUInt64(v uint64)

WriteUInt64 ...

func (*Writer) WriteUInt64LE

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