apimachinery: k8s.io/apimachinery/pkg/util/framer Index | Files

package framer

import "k8s.io/apimachinery/pkg/util/framer"

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


Package Files


func NewJSONFramedReader Uses

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 Uses

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 Uses

func NewLengthDelimitedFrameWriter(w io.Writer) io.Writer

Package framer imports 3 packages (graph) and is imported by 5 packages. Updated 2018-03-22. Refresh now. Tools for package owners.