vitess: Index | Files

package cgzip

import ""

Package cgzip wraps the C library for gzip.


Package Files

adler32.go crc32.go doc.go reader.go writer.go zstream.go


const (
    // Allowed flush values
    Z_NO_FLUSH      = 0
    Z_SYNC_FLUSH    = 2
    Z_FULL_FLUSH    = 3
    Z_FINISH        = 4
    Z_BLOCK         = 5
    Z_TREES         = 6

    // Return codes
    Z_OK            = 0
    Z_STREAM_END    = 1
    Z_NEED_DICT     = 2
    Z_ERRNO         = -1
    Z_STREAM_ERROR  = -2
    Z_DATA_ERROR    = -3
    Z_MEM_ERROR     = -4
    Z_BUF_ERROR     = -5

    // compression levels
    Z_NO_COMPRESSION      = 0
    Z_BEST_SPEED          = 1

    // our default buffer size
    // most go io functions use 32KB as buffer size, so 32KB
    // works well here for compressed data buffer

func NewAdler32 Uses

func NewAdler32() hash.Hash32

NewAdler32 creates an empty buffer which has an adler32 of '1'. The go hash/adler32 does the same.

func NewCrc32 Uses

func NewCrc32() hash.Hash32

NewCrc32 creates an empty buffer which has an crc32 of '1'. The go hash/crc32 does the same.

func NewReader Uses

func NewReader(r io.Reader) (io.ReadCloser, error)

NewReader returns a new cgzip.reader for reading gzip files with the C gzip library.

func NewReaderBuffer Uses

func NewReaderBuffer(r io.Reader, bufferSize int) (io.ReadCloser, error)

NewReaderBuffer returns a new cgzip.reader with a given buffer size for reading gzip files with the C gzip library.

type Writer Uses

type Writer struct {
    // contains filtered or unexported fields

err starts out as nil we will call deflateEnd when we set err to a value: - whatever error is returned by the underlying writer - io.EOF if Close was called

func NewWriter Uses

func NewWriter(w io.Writer) *Writer

func NewWriterLevel Uses

func NewWriterLevel(w io.Writer, level int) (*Writer, error)

func NewWriterLevelBuffer Uses

func NewWriterLevelBuffer(w io.Writer, level, bufferSize int) (*Writer, error)

func (*Writer) Close Uses

func (z *Writer) Close() error

Calling Close does not close the wrapped io.Writer originally passed to NewWriterX.

func (*Writer) Flush Uses

func (z *Writer) Flush() error

func (*Writer) Write Uses

func (z *Writer) Write(p []byte) (n int, err error)

Package cgzip imports 5 packages (graph) and is imported by 23 packages. Updated 2018-12-06. Refresh now. Tools for package owners.