snappy

package module
v0.0.0-...-8f88e69 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: MIT Imports: 4 Imported by: 0

README

go-xerial-snappy

Build Status

Xerial-compatible Snappy framing support for golang.

Packages using Xerial for snappy encoding use a framing format incompatible with basically everything else in existence. This package wraps Go's built-in snappy package to support it.

Apps that use this format include Apache Kafka (see https://github.com/dpkp/kafka-python/issues/126#issuecomment-35478921 for details).

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HeaderSize = len(currentHeader)

	MinBlockSize = 1 * 1024

	DefaultBlockSize = 32 * 1024
)

Functions

func Decode

func Decode(src []byte) ([]byte, error)

Decode decodes snappy data whether it is traditional unframed or includes the xerial framing format.

func Encode

func Encode(src []byte) []byte

Encode encodes data as snappy with no framing header.

func EncodeXerialFramingFormat

func EncodeXerialFramingFormat(src []byte) []byte

Encode encodes data as snappy with xerial framing format

Types

type Writer

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

'copy' from org.xerial.snappy.SnappyOutputStream

func NewWriter

func NewWriter(w io.Writer) *Writer

func NewWriterWithBlockSize

func NewWriterWithBlockSize(w io.Writer, blockSize int) *Writer

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) Flush

func (w *Writer) Flush() error

func (*Writer) Reset

func (w *Writer) Reset(writer io.Writer)

func (*Writer) Write

func (w *Writer) Write(data []byte) (n int, err error)

Jump to

Keyboard shortcuts

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