Documentation ¶
Overview ¶
Package cgzip wraps the C library for gzip.
Index ¶
- Constants
- func Adler32Combine(adler1, adler2 uint32, len2 int) uint32
- func Crc32Combine(crc1, crc2 uint32, len2 int) uint32
- func NewAdler32() hash.Hash32
- func NewCrc32() hash.Hash32
- func NewReader(r io.Reader) (io.ReadCloser, error)
- func NewReaderBuffer(r io.Reader, bufferSize int) (io.ReadCloser, error)
- type Writer
Constants ¶
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 Adler32Combine ¶
Adler32Combine method for partial checksums. From the zlib.h header:
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
func Crc32Combine ¶
Crc32Combine helper method for partial checksums. From the zlib.h header:
Combine two CRC-32 checksums into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, CRC-32 checksums were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 checksum of seq1 and seq2 concatenated, requiring only crc1, crc2, and len2.
func NewAdler32 ¶
NewAdler32 creates an empty buffer which has an adler32 of '1'. The go hash/adler32 does the same.
func NewCrc32 ¶
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 ¶
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