Namespace: go.std.compress.flate
v1.0Contents
Summary
Provides a low-level interface to the compress/flate package.
Package flate implements the DEFLATE compressed data format, described in
RFC 1951. The gzip and zlib packages implement access to DEFLATE-based file
formats.
Index
- *CorruptInputError
- *InternalError
- *ReadError
- *WriteError
- *Writer
- BestCompression
- BestSpeed
- CorruptInputError
- DefaultCompression
- HuffmanOnly
- InternalError
- NewReader
- NewReaderDict
- NewWriter
- NewWriterDict
- NoCompression
- ReadError
- Reader
- Resetter
- WriteError
- Writer
- arrayOfCorruptInputError
- arrayOfInternalError
- arrayOfReadError
- arrayOfReader
- arrayOfResetter
- arrayOfWriteError
- arrayOfWriter
Legend
-
Constant
Variable
Function
Macro
Special form
Type
GoVar
Receiver/Method
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
BestCompression
Int v1.0 -
BestSpeed
Int v1.0 -
DefaultCompression
Int v1.0 -
HuffmanOnly
Int v1.0HuffmanOnly disables Lempel-Ziv match searching and only performs Huffman
entropy encoding. This mode is useful in compressing data that has
already been compressed with an LZ style algorithm (e.g. Snappy or LZ4)
that lacks an entropy encoder. Compression gains are achieved when
certain bytes in the input stream occur more frequently than others.
Note that HuffmanOnly produces a compressed output that is
RFC 1951 compliant. That is, any valid DEFLATE decompressor will
continue to be able to decompress this output.
-
NoCompression
Int v1.0
Variables
-
(None.)
Functions, Macros, and Special Forms
-
NewReader
Function v1.0(NewReader r)
NewReader returns a new ReadCloser that can be used
to read the uncompressed version of r.
If r does not also 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 finished reading.
The ReadCloser returned by NewReader also implements Resetter.
Go input arguments: (r io.Reader)
Go returns: io.ReadCloser
Joker input arguments: [^go.std.io/Reader r]
Joker returns: ^go.std.io/ReadCloser -
NewReaderDict
Function v1.0(NewReaderDict r dict)
NewReaderDict is like NewReader but initializes the reader
with a preset dictionary. The returned Reader behaves as if
the uncompressed data stream started with the given dictionary,
which has already been read. NewReaderDict is typically used
to read data compressed by NewWriterDict.
The ReadCloser returned by NewReader also implements Resetter.
Go input arguments: (r io.Reader, dict []byte)
Go returns: io.ReadCloser
Joker input arguments: [^go.std.io/Reader r, ^arrayOfByte dict]
Joker returns: ^go.std.io/ReadCloser -
NewWriter
Function v1.0(NewWriter w level)
NewWriter returns a new Writer compressing data at the given level.
Following zlib, levels range from 1 (BestSpeed) to 9 (BestCompression);
higher levels typically run slower but compress more. Level 0
(NoCompression) does not attempt any compression; it only adds the
necessary DEFLATE framing.
Level -1 (DefaultCompression) uses the default compression level.
Level -2 (HuffmanOnly) will use Huffman compression only, giving
a very fast compression for all types of input, but sacrificing considerable
compression efficiency.
If level is in the range [-2, 9] then the error returned will be nil.
Otherwise the error returned will be non-nil.
Go input arguments: (w io.Writer, level int)
Go returns: (*Writer, error)
Joker input arguments: [^go.std.io/Writer w, ^Int level]
Joker returns: [^*Writer, ^Error] -
NewWriterDict
Function v1.0(NewWriterDict w level dict)
NewWriterDict is like NewWriter but initializes the new
Writer with a preset dictionary. The returned Writer behaves
as if the dictionary had been written to it without producing
any compressed output. The compressed data written to w
can only be decompressed by a Reader initialized with the
same dictionary.
Go input arguments: (w io.Writer, level int, dict []byte)
Go returns: (*Writer, error)
Joker input arguments: [^go.std.io/Writer w, ^Int level, ^arrayOfByte dict]
Joker returns: [^*Writer, ^Error]
Types
-
*CorruptInputError
Concrete Type v1.0A CorruptInputError reports the presence of corrupt input at a given offset.
-
*InternalError
Concrete Type v1.0An InternalError reports an error in the flate code itself.
-
*ReadError
Concrete Type v1.0A ReadError reports an error encountered while reading input.
Deprecated: No longer returned.
-
Error
Receiver for *ReadError v1.0([])
-
*WriteError
Concrete Type v1.0A WriteError reports an error encountered while writing output.
Deprecated: No longer returned.
-
Error
Receiver for *WriteError v1.0([])
-
*Writer
Concrete Type v1.0A Writer takes data written to it and writes the compressed
form of that data to an underlying writer (see NewWriter).
-
Close
Receiver for *Writer v1.0([])
Close flushes and closes the writer.
-
Flush
Receiver for *Writer v1.0([])
Flush flushes any pending data to the underlying writer.
It is useful mainly in compressed network protocols, to ensure that
a remote reader has enough data to reconstruct a packet.
Flush does not return until the data has been written.
Calling Flush when there is no pending data still causes the Writer
to emit a sync marker of at least 4 bytes.
If the underlying writer returns an error, Flush returns that error.
In the terminology of the zlib library, Flush is equivalent to Z_SYNC_FLUSH.
-
Reset
Receiver for *Writer v1.0([dst])
Reset discards the writer's state and makes it equivalent to
the result of NewWriter or NewWriterDict called with dst
and w's level and dictionary.
-
Write
Receiver for *Writer v1.0([data])
Write writes data to w, which will eventually write the
compressed form of data to its underlying writer.
-
CorruptInputError
Concrete Type v1.0A CorruptInputError reports the presence of corrupt input at a given offset.
-
Error
Receiver for CorruptInputError v1.0([])
-
InternalError
Concrete Type v1.0An InternalError reports an error in the flate code itself.
-
Error
Receiver for InternalError v1.0([])
-
ReadError
Concrete Type v1.0A ReadError reports an error encountered while reading input.
Deprecated: No longer returned.
-
Reader
Abstract Type v1.0The actual read interface needed by NewReader.
If the passed in io.Reader does not also have ReadByte,
the NewReader will introduce its own buffering.
-
Read
Method for Reader v1.0([p])
-
ReadByte
Method for Reader v1.0([])
-
Resetter
Abstract Type v1.0Resetter resets a ReadCloser returned by NewReader or NewReaderDict
to switch to a new underlying Reader. This permits reusing a ReadCloser
instead of allocating a new one.
-
Reset
Method for Resetter v1.0([r dict])
-
WriteError
Concrete Type v1.0A WriteError reports an error encountered while writing output.
Deprecated: No longer returned.
-
Writer
Concrete Type v1.0A Writer takes data written to it and writes the compressed
form of that data to an underlying writer (see NewWriter).
-
arrayOfCorruptInputError
Concrete Type v1.0A CorruptInputError reports the presence of corrupt input at a given offset.
-
arrayOfInternalError
Concrete Type v1.0An InternalError reports an error in the flate code itself.
-
arrayOfReadError
Concrete Type v1.0A ReadError reports an error encountered while reading input.
Deprecated: No longer returned.
-
arrayOfReader
Concrete Type v1.0The actual read interface needed by NewReader.
If the passed in io.Reader does not also have ReadByte,
the NewReader will introduce its own buffering.
-
arrayOfResetter
Concrete Type v1.0Resetter resets a ReadCloser returned by NewReader or NewReaderDict
to switch to a new underlying Reader. This permits reusing a ReadCloser
instead of allocating a new one.
-
arrayOfWriteError
Concrete Type v1.0A WriteError reports an error encountered while writing output.
Deprecated: No longer returned.
-
arrayOfWriter
Concrete Type v1.0A Writer takes data written to it and writes the compressed
form of that data to an underlying writer (see NewWriter).