stream

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const MaxBodyLen = 1<<16 - 1

Variables

View Source
var ErrMessageTooLarge = errors.New("message too large")

Functions

This section is empty.

Types

type Decoder

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

A Decoder reads and decodes Proto Buffer values from an input stream.

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

NewDecoder returns a new decoder that reads from r.

The decoder introduces its own buffering and may read data from r beyond the Proto Buffer values requested.

func (*Decoder) Decode

func (dec *Decoder) Decode(m proto.Message) error

Decode reads the next ProtoBuffer-encoded value from its input and stores it in the value pointed to by v.

type Encoder

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

An Encoder writes JSON values to an output stream.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder returns a new encoder that writes to w.

func (*Encoder) Encode

func (enc *Encoder) Encode(m proto.Message) error

Encode writes the Proto Buffer encoding of v to the stream. preceded by big-endian uint16 len.

Jump to

Keyboard shortcuts

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