package snappy
import "github.com/google/cadvisor/Godeps/_workspace/src/github.com/golang/snappy"
Package snappy implements the snappy block-based compression format. It aims for very high speeds and reasonable compression.
The C++ snappy implementation is at https://github.com/google/snappy
Index ¶
- Variables
- func Decode(dst, src []byte) ([]byte, error)
- func DecodedLen(src []byte) (int, error)
- func Encode(dst, src []byte) []byte
- func MaxEncodedLen(srcLen int) int
- type Reader
- func NewReader(r io.Reader) *Reader
- func (r *Reader) Read(p []byte) (int, error)
- func (r *Reader) Reset(reader io.Reader)
- type Writer
Variables ¶
var ( // ErrCorrupt reports that the input is invalid. ErrCorrupt = errors.New("snappy: corrupt input") // ErrTooLarge reports that the uncompressed length is too large. ErrTooLarge = errors.New("snappy: decoded block is too large") // ErrUnsupported reports that the input isn't supported. ErrUnsupported = errors.New("snappy: unsupported input") )
Functions ¶
func Decode ¶
Decode returns the decoded form of src. The returned slice may be a sub- slice of dst if dst was large enough to hold the entire decoded block. Otherwise, a newly allocated slice will be returned. It is valid to pass a nil dst.
func DecodedLen ¶
DecodedLen returns the length of the decoded block.
func Encode ¶
Encode returns the encoded form of src. The returned slice may be a sub- slice of dst if dst was large enough to hold the entire encoded block. Otherwise, a newly allocated slice will be returned. It is valid to pass a nil dst.
func MaxEncodedLen ¶
MaxEncodedLen returns the maximum length of a snappy block, given its uncompressed length.
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is an io.Reader than can read Snappy-compressed bytes.
func NewReader ¶
NewReader returns a new Reader that decompresses from r, using the framing format described at https://github.com/google/snappy/blob/master/framing_format.txt
func (*Reader) Read ¶
Read satisfies the io.Reader interface.
func (*Reader) Reset ¶
Reset discards any buffered data, resets all state, and switches the Snappy reader to read from r. This permits reusing a Reader rather than allocating a new one.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer is an io.Writer than can write Snappy-compressed bytes.
func NewWriter ¶
NewWriter returns a new Writer that compresses to w, using the framing format described at https://github.com/google/snappy/blob/master/framing_format.txt
func (*Writer) Reset ¶
Reset discards the writer's state and switches the Snappy writer to write to w. This permits reusing a Writer rather than allocating a new one.
func (*Writer) Write ¶
Write satisfies the io.Writer interface.
Source Files ¶
- Version
- v0.23.6
- Published
- Jun 24, 2016
- Platform
- js/wasm
- Imports
- 4 packages
- Last checked
- 2 minutes ago –
Tools for package owners.