racdict

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package racdict provides support for the RAC (Random Access Compression) common dictionary format.

See https://github.com/google/wuffs/blob/master/doc/spec/rac-spec.md#common-dictionary-format

Index

Constants

View Source
const (
	// MaxInclLength is the maximum (inclusive) length of a dictionary, not
	// including the length prefix and the checksum suffix.
	//
	// Its value is (1 GiB - 1), or 1_073_741_823 bytes.
	MaxInclLength = (1 << 30) - 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Loader

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

Loader loads a dictionary wrapped in the RAC common dictionary format.

It can cache previously loaded values, keyed by a rac.Chunk.

func (*Loader) Load

func (r *Loader) Load(rs io.ReadSeeker, chunk rac.Chunk) (dictionary []byte, retErr error)

Load reads and unwraps a wrapped dictionary.

type Saver

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

Saver saves a dictionary wrapped in the RAC common dictionary format.

func (*Saver) Compress

func (w *Saver) Compress(
	p []byte,
	q []byte,
	resourcesData [][]byte,
	codec rac.Codec,
	compress func(p []byte, q []byte, dict []byte) ([]byte, error),
	refineResourceData func([]byte) []byte,
) (
	retCodec rac.Codec,
	compressed []byte,
	secondaryResource int,
	tertiaryResource int,
	retErr error,
)

Compress helps implement rac.CodecWriter.

func (*Saver) WrapResource

func (w *Saver) WrapResource(
	raw []byte,
	refineResourceData func([]byte) []byte,
) ([]byte, error)

WrapResource wraps a dictionary.

Jump to

Keyboard shortcuts

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