packed

package
v2.18.2+incompatible Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package packed provides functions to read and write the "packed" compression scheme described at https://capnproto.org/encoding.html#packing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pack

func Pack(dst, src []byte) []byte

Pack appends the packed version of src to dst and returns the resulting slice. len(src) must be a multiple of 8 or Pack panics.

func Unpack

func Unpack(dst, src []byte) ([]byte, error)

Unpack appends the unpacked version of src to dst and returns the resulting slice.

Types

type Reader

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

A Reader decompresses a packed byte stream.

func NewReader

func NewReader(r *bufio.Reader) *Reader

NewReader returns a reader that decompresses a packed stream from r.

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

Read reads up to len(p) bytes into p. This will decompress whole words at a time, so mixing calls to Read and ReadWord may lead to bytes missing.

func (*Reader) ReadWord

func (r *Reader) ReadWord(p []byte) error

ReadWord decompresses the next word from the underlying stream.

Jump to

Keyboard shortcuts

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