binary

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

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

Marshal returns the binary encoding of v.

func MarshalForVarint

func MarshalForVarint(i interface{}) ([]byte, error)

ensures that littleEndian is used to encode varint value

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder reads and decodes binary data from an input stream.

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

NewDecoder returns a new Decoder that reads from r.

func (Decoder) Decode

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

Decode ...

func (Decoder) DecodeBytes

func (d Decoder) DecodeBytes(len int64) ([]byte, error)

func (Decoder) DecodeUint16ForVarint

func (d Decoder) DecodeUint16ForVarint() (uint16, error)

func (Decoder) ReadUntilEOF

func (d Decoder) ReadUntilEOF() (bytes.Buffer, error)

type Marshaler

type Marshaler interface {
	MarshalBinary() ([]byte, error)
}

Marshaler is the interface implemented by types that can marshal themselves into binary.

type Unmarshaler

type Unmarshaler interface {
	UnmarshalBinary(r io.Reader) error
}

Unmarshaler is the interface implemented by types that can unmarshal themselves from binary.

Jump to

Keyboard shortcuts

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