gobtools

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: CC0-1.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DecodingIntoNilObject      = errors.Template("Illegal attempt to decode into a nil object.")
	EncodingVersion            = errors.Template("Encoding version %d not supported.")
	DecodingIntoExistingObject = errors.Template("Illegal attempt to decode into an existing object.")
)

Common errors.

Variables

This section is empty.

Functions

func NewDecoder

func NewDecoder(buf []byte) *gob.Decoder

NewDecoder returns a new decoder for the given slice of bytes.

func ReuseEncoder

func ReuseEncoder(enc *Encoder)

ReuseEncoder returns the given encoder to a pool ready for reuse by subsequent calls to NewEncoder.

Types

type Encoder

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

Encoder provides a gob encoder backed by a bytes buffer.

func NewEncoder

func NewEncoder() *Encoder

NewEncoder returns a new encoder.

func (*Encoder) Bytes

func (enc *Encoder) Bytes() []byte

Bytes returns the slice of bytes encoded to-date.

func (*Encoder) Encode

func (enc *Encoder) Encode(e interface{}) error

Encode transmits the data item represented by the empty interface value, guaranteeing that all necessary type information has been transmitted first.

func (*Encoder) EncodeValue

func (enc *Encoder) EncodeValue(value reflect.Value) error

EncodeValue transmits the data item represented by the reflection value, guaranteeing that all necessary type information has been transmitted first.

func (*Encoder) Len

func (enc *Encoder) Len() int

Len returns the number of bytes used by the encoder's underlying buffer.

func (*Encoder) Reset

func (enc *Encoder) Reset()

Reset resets the encoder.

Jump to

Keyboard shortcuts

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