gobutil

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: MIT Imports: 4 Imported by: 12

Documentation

Index

Constants

This section is empty.

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