package zlib
Import Path
compress/zlib (on golang.org and go.dev)
Dependency Relation
imports 8 packages, and imported by 4 packages
Involved Source Files
d-> reader.go
writer.go
Exported Type Names
Exported Values
const
BestCompression = 9
These constants are copied from the flate package, so that code that imports
"compress/zlib" does not also have to import "compress/flate".
const
BestSpeed = 1
These constants are copied from the flate package, so that code that imports
"compress/zlib" does not also have to import "compress/flate".
const
DefaultCompression = -1
These constants are copied from the flate package, so that code that imports
"compress/zlib" does not also have to import "compress/flate".
var
ErrChecksum error
ErrChecksum is returned when reading ZLIB data that has an invalid checksum.
var
ErrDictionary error
ErrDictionary is returned when reading ZLIB data that has an invalid dictionary.
const
HuffmanOnly = -2
These constants are copied from the flate package, so that code that imports
"compress/zlib" does not also have to import "compress/flate".
func
NewReader(r
io.
Reader) (
io.
ReadCloser,
error)
NewReader creates a new ReadCloser.
Reads from the returned ReadCloser read and decompress data from r.
If r does not implement io.ByteReader, the decompressor may read more
data than necessary from r.
It is the caller's responsibility to call Close on the ReadCloser when done.
The ReadCloser returned by NewReader also implements Resetter.
func
NewReaderDict(r
io.
Reader, dict []
byte) (
io.
ReadCloser,
error)
NewReaderDict is like NewReader but uses a preset dictionary.
NewReaderDict ignores the dictionary if the compressed data does not refer to it.
If the compressed data refers to a different dictionary, NewReaderDict returns ErrDictionary.
The ReadCloser returned by NewReaderDict also implements Resetter.
func
NewWriter(w
io.
Writer) *
Writer
NewWriter creates a new Writer.
Writes to the returned Writer are compressed and written to w.
It is the caller's responsibility to call Close on the Writer when done.
Writes may be buffered and not flushed until Close.
func
NewWriterLevel(w
io.
Writer, level
int) (*
Writer,
error)
NewWriterLevel is like NewWriter but specifies the compression level instead
of assuming DefaultCompression.
The compression level can be DefaultCompression, NoCompression, HuffmanOnly
or any integer value between BestSpeed and BestCompression inclusive.
The error returned will be nil if the level is valid.
func
NewWriterLevelDict(w
io.
Writer, level
int, dict []
byte) (*
Writer,
error)
NewWriterLevelDict is like NewWriterLevel but specifies a dictionary to
compress with.
The dictionary may be nil. If not, its contents should not be modified until
the Writer is closed.
const
NoCompression = 0
These constants are copied from the flate package, so that code that imports
"compress/zlib" does not also have to import "compress/flate".
 |
The pages are generated with Golds v0.1.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project and developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |