bytes

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2021 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromBytesWithLength32

func FromBytesWithLength32(b []byte) (bb []byte)

FromBytesWithLength32 the data to the writer after the length of the data The length will store with int32

func FromBytesWithLength64

func FromBytesWithLength64(b []byte) (bb []byte)

FromBytesWithLength64 the data to the writer after the length of the data The length will store with int64

func FromFloat32

func FromFloat32(value float32) (b []byte)

FromFloat32 transfer from float32 to []byte

func FromFloat64

func FromFloat64(value float64) (b []byte)

FromFloat64 transfer from float64 to []byte

func FromInt16

func FromInt16(value int16) (b []byte)

FromInt16 transfer from int16 to []byte

func FromInt32

func FromInt32(value int32) (b []byte)

FromInt32 transfer from int32 to []byte

func FromInt64

func FromInt64(value int64) (b []byte)

FromInt64 transfer from int64 to []byte

func FromInt8

func FromInt8(value int8) (b []byte)

FromInt8 transfer from int8 to []byte

func FromString

func FromString(value string) (b []byte)

FromString transfer from string to []byte

func FromStringWithLength32

func FromStringWithLength32(value string) (b []byte)

FromStringWithLength32 transfer string to []byte with 32-bit length

func FromStringWithLength64

func FromStringWithLength64(value string) (b []byte)

FromStringWithLength64 transfer string to []byte with 64-bit length

func FromUint16

func FromUint16(value uint16) (b []byte)

FromUint16 transfer from uint16 to []byte

func FromUint32

func FromUint32(value uint32) (b []byte)

FromUint32 transfer from uint32 to []byte

func FromUint64

func FromUint64(value uint64) (b []byte)

FromUint64 transfer from uint64 to []byte

func FromUint8

func FromUint8(value uint8) (b []byte)

FromUint8 transfer from uint8 to []byte

func NewBuffer

func NewBuffer(b ...byte) *bytes.Buffer

NewBuffer initial a empty bytes.Buffer

func ReadBytesWithLength32

func ReadBytesWithLength32(r io.Reader) (b []byte, err error)

ReadBytesWithLength32 read an int32 length first, and then read the data with length

func ReadBytesWithLength64

func ReadBytesWithLength64(r io.Reader) (b []byte, err error)

ReadBytesWithLength64 read an int64 length first, and then read the data with length ONLY USE IN 64-BIT SYSTEM

func ReadFloat32

func ReadFloat32(r io.Reader) (v float32, err error)

ReadFloat32 read a float32 value

func ReadFloat64

func ReadFloat64(r io.Reader) (v float64, err error)

ReadFloat64 read a float64 value

func ReadInt16

func ReadInt16(r io.Reader) (v int16, err error)

ReadInt16 read an int16 value

func ReadInt32

func ReadInt32(r io.Reader) (v int32, err error)

ReadInt32 read an int32 value

func ReadInt64

func ReadInt64(r io.Reader) (v int64, err error)

ReadInt64 read an int64 value

func ReadInt8

func ReadInt8(r io.Reader) (v int8, err error)

ReadInt8 read an int8 value

func ReadNBytes

func ReadNBytes(r io.Reader, n int) (b []byte, err error)

ReadNBytes read n bytes from a io.Reader

func ReadStringWithLength32

func ReadStringWithLength32(r io.Reader) (value string, err error)

ReadStringWithLength32 read string with 32-bit length from reader

func ReadStringWithLength64

func ReadStringWithLength64(r io.Reader) (value string, err error)

ReadStringWithLength64 read string with 64-bit length from reader

func ReadUint16

func ReadUint16(r io.Reader) (v uint16, err error)

ReadUint16 read an uint16 value

func ReadUint32

func ReadUint32(r io.Reader) (v uint32, err error)

ReadUint32 read an uint32 value

func ReadUint64

func ReadUint64(r io.Reader) (v uint64, err error)

ReadUint64 read an uint64 value

func ReadUint8

func ReadUint8(r io.Reader) (v uint8, err error)

ReadUint8 read an uint8 value

func ToFloat32

func ToFloat32(b []byte) (value float32)

ToFloat32 transfer from []byte to float32

func ToFloat64

func ToFloat64(b []byte) (value float64)

ToFloat64 transfer from []byte to float64

func ToInt16

func ToInt16(b []byte) (value int16)

ToInt16 transfer from []byte to int16

func ToInt32

func ToInt32(b []byte) (value int32)

ToInt32 transfer from []byte to int32

func ToInt64

func ToInt64(b []byte) (value int64)

ToInt64 transfer from []byte to int64

func ToInt8

func ToInt8(b []byte) (value int8)

ToInt8 transfer from []byte to int8

func ToUint16

func ToUint16(b []byte) (value uint16)

ToUint16 transfer from []byte to uint16

func ToUint32

func ToUint32(b []byte) (value uint32)

ToUint32 transfer from []byte to uint32

func ToUint64

func ToUint64(b []byte) (value uint64)

ToUint64 transfer from []byte to uint64

func ToUint8

func ToUint8(b []byte) (value uint8)

ToUint8 transfer from []byte to uint8

Types

type Serializable

type Serializable interface {
	ToBytes() []byte
}

Serializable could be serialization type

Jump to

Keyboard shortcuts

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