cgzip

package
v3.0.0-rc.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cgzip wraps the C library for gzip.

Index

Constants

View Source
const (
	// Allowed flush values
	Z_NO_FLUSH      = 0
	Z_PARTIAL_FLUSH = 1
	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
	Z_VERSION_ERROR = -6

	// compression levels
	Z_NO_COMPRESSION      = 0
	Z_BEST_SPEED          = 1
	Z_BEST_COMPRESSION    = 9
	Z_DEFAULT_COMPRESSION = -1

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

Variables

This section is empty.

Functions

func NewAdler32

func NewAdler32() hash.Hash32

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

func NewCrc32

func NewCrc32() hash.Hash32

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

func NewReader

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

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.

Types

type Writer

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

func NewWriter(w io.Writer) *Writer

func NewWriterLevel

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

func NewWriterLevelBuffer

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

func (*Writer) Close

func (z *Writer) Close() error

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

func (*Writer) Flush

func (z *Writer) Flush() error

func (*Writer) Write

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

Jump to

Keyboard shortcuts

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