binary

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LittleEndian  = binary.LittleEndian
	BigEndian     = binary.BigEndian
	DefaultEndian = LittleEndian
)

Functions

func Marshal

func Marshal(v interface{}) ([]byte, error)

func Unmarshal

func Unmarshal(b []byte, v interface{}) error

Types

type Decoder

type Decoder struct {
	Order binary.ByteOrder
	// contains filtered or unexported fields
}

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode(v interface{}) (err error)

type Encoder

type Encoder struct {
	Order binary.ByteOrder
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

func NewStrictEncoder

func NewStrictEncoder(w io.Writer) *Encoder

NewStrictEncoder creates an encoder similar to NewEncoder, however if this encoder attempts to encode a struct and the struct has no encodable fields an error is returned whereas the encoder returned from NewEncoder will simply not write anything to `w`.

func (*Encoder) Encode

func (b *Encoder) Encode(v interface{}) (err error)

Jump to

Keyboard shortcuts

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