framer

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2017 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package framer implements simple frame decoding techniques for an io.ReadCloser

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewJSONFramedReader

func NewJSONFramedReader(r io.ReadCloser) io.ReadCloser

NewJSONFramedReader returns an io.Reader that will decode individual JSON objects off of a wire.

The boundaries between each frame are valid JSON objects. A JSON parsing error will terminate the read.

func NewLengthDelimitedFrameReader

func NewLengthDelimitedFrameReader(r io.ReadCloser) io.ReadCloser

NewLengthDelimitedFrameReader returns an io.Reader that will decode length-prefixed frames off of a stream.

The protocol is:

stream: message ...
message: prefix body
prefix: 4 byte uint32 in BigEndian order, denotes length of body
body: bytes (0..prefix)

If the buffer passed to Read is not long enough to contain an entire frame, io.ErrShortRead will be returned along with the number of bytes read.

func NewLengthDelimitedFrameWriter

func NewLengthDelimitedFrameWriter(w io.Writer) io.Writer

Types

This section is empty.

Jump to

Keyboard shortcuts

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