encoding

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

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

Decoder is a low-level decoder for decoding basic types.

func NewDecoder

func NewDecoder(buf []byte) *Decoder

NewDecoder returns a new Decoder.

func (*Decoder) Bytes

func (d *Decoder) Bytes() ([]byte, error)

Bytes reads a byte slice from the decoder.

func (*Decoder) Reset

func (d *Decoder) Reset(buf []byte)

Reset resets the decoder.

func (*Decoder) Uint32

func (d *Decoder) Uint32() (uint32, error)

Uint32 reads a uint32 from the decoder.

func (*Decoder) Uint64

func (d *Decoder) Uint64() (uint64, error)

Uint64 reads a uint64 from the decoder.

func (*Decoder) Uvarint

func (d *Decoder) Uvarint() (uint64, error)

Uvarint reads a variable-sized unsigned integer.

type Encoder

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

Encoder is a low-level encoder that can be used for encoding basic types.

func NewEncoder

func NewEncoder(n int) *Encoder

NewEncoder returns a new encoder.

func (*Encoder) Bytes

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

Bytes returns the encoded bytes.

func (*Encoder) Len

func (e *Encoder) Len() int

Len returns the length of the encoder.

func (*Encoder) PutBytes

func (e *Encoder) PutBytes(b []byte) int

PutBytes encodes a byte slice and returns the number of bytes written.

func (*Encoder) PutUint32

func (e *Encoder) PutUint32(x uint32) int

PutUint32 encodes a uint32 and returns the number of bytes written which is always 4.

func (*Encoder) PutUint64

func (e *Encoder) PutUint64(x uint64) int

PutUint64 encodes a uint64 and returns the number of bytes written which is always 8.

func (*Encoder) PutUvarint

func (e *Encoder) PutUvarint(x uint64) int

PutUvarint encodes a variable-sized unsigned integer and returns the number of bytes written.

func (*Encoder) Reset

func (e *Encoder) Reset()

Reset resets the encoder.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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