byteutils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2017 License: LGPL-3.0 Imports: 2 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(data []byte, dec Decoder) (interface{}, error)

Decode decodes []byte from Decoder.

func Encode

func Encode(s interface{}, enc Encoder) ([]byte, error)

Encode encodes object to Encoder.

func Equal

func Equal(a []byte, b []byte) bool

Equal checks whether byte slice a and b are equal.

func FromHex

func FromHex(data string) ([]byte, error)

FromHex decodes string from Hex.

func FromInt16

func FromInt16(v int16) []byte

FromInt16 decodes int16 v.

func FromInt32

func FromInt32(v int32) []byte

FromInt32 decodes int32 v.

func FromInt64

func FromInt64(v int64) []byte

FromInt64 decodes int64 v.

func FromUint16

func FromUint16(v uint16) []byte

FromUint16 decodes uint16.

func FromUint32

func FromUint32(v uint32) []byte

FromUint32 decodes uint32.

func FromUint64

func FromUint64(v uint64) []byte

FromUint64 decodes unit64 value.

func Hex

func Hex(data []byte) string

Hex encodes []byte to Hex.

func Int16

func Int16(data []byte) int16

Int16 encode []byte.

func Int32

func Int32(data []byte) int32

Int32 encodes []byte.

func Int64

func Int64(data []byte) int64

Int64 encodes []byte.

func Uint16

func Uint16(data []byte) uint16

Uint16 encodes []byte.

func Uint32

func Uint32(data []byte) uint32

Uint32 encodes []byte.

func Uint64

func Uint64(data []byte) uint64

Uint64 encodes []byte.

Types

type Decoder

type Decoder interface {
	DecodeFromBytes(data []byte) (interface{}, error)
}

Decoder is decoder for bytes.Decode().

type Encoder

type Encoder interface {
	EncodeToBytes(s interface{}) ([]byte, error)
}

Encoder is encoder for bytes.Encode().

Jump to

Keyboard shortcuts

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