Documentation
¶
Index ¶
- Constants
- func DeflateCopy(dest Streamp, source Streamp) c.Int
- func Version() *c.Char
- type GzFile
- type GzFileS
- type Off64T
- type SizeT
- type Stream
- type StreamS
- type Streamp
- func (self Streamp) DeflateBound(sourceLen ULong) ULong
- func (self Streamp) DeflateBoundZ(sourceLen SizeT) SizeT
- func (self Streamp) DeflateInit(level c.Int) c.Int
- func (self Streamp) DeflateInit2(level c.Int, method c.Int, windowBits c.Int, memLevel c.Int, strategy c.Int) c.Int
- func (self Streamp) DeflateInit2_(level c.Int, method c.Int, windowBits c.Int, memLevel c.Int, strategy c.Int, ...) c.Int
- func (self Streamp) DeflateInit_(level c.Int, version *c.Char, stream_size c.Int) c.Int
- func (self Streamp) DeflateReset() c.Int
- func (self Streamp) InflateBackInit(windowBits c.Int, window *uint8) c.Int
- func (self Streamp) InflateBackInit_(windowBits c.Int, window *uint8, version *c.Char, stream_size c.Int) c.Int
- func (self Streamp) InflateInit() c.Int
- func (self Streamp) InflateInit2(windowBits c.Int) c.Int
- func (self Streamp) InflateInit2_(windowBits c.Int, version *c.Char, stream_size c.Int) c.Int
- func (self Streamp) InflateInit_(version *c.Char, stream_size c.Int) c.Int
- type ULong
Constants ¶
const ( LLGoPackage = "link: $(pkg-config --libs zlib); -lz" LLGoFiles = "-I/path/foo/include: _wrap/llcppg.c" )
const ( NO_FLUSH = 0 PARTIAL_FLUSH = 1 SYNC_FLUSH = 2 FULL_FLUSH = 3 FINISH = 4 BLOCK = 5 TREES = 6 )
Allowed flush values; see deflate() and inflate() below for details
const ( OK = 0 STREAM_END = 1 NEED_DICT = 2 ERRNO = -1 STREAM_ERROR = -2 DATA_ERROR = -3 MEM_ERROR = -4 BUF_ERROR = -5 VERSION_ERROR = -6 )
Return codes for the compression/decompression functions. Negative values are errors, positive values are used for special but normal events.
const ( NO_COMPRESSION = 0 BEST_SPEED = 1 BEST_COMPRESSION = 9 DEFAULT_COMPRESSION = -1 )
compression levels
const ( FILTERED = 1 HUFFMAN_ONLY = 2 RLE = 3 FIXED = 4 DEFAULT_STRATEGY = 0 )
compression strategy; see deflateInit2() below for details
const ( BINARY = 0 TEXT = 1 // for compatibility with 1.2.2 and earlier ASCII = 1 UNKNOWN = 2 )
Possible values of the data_type field for deflate()
const DEFLATED = 8
The deflate compression method (the only one supported in this version)
const NULL = 0
for initializing zalloc, zfree, opaque
Variables ¶
This section is empty.
Functions ¶
func DeflateCopy ¶
Sets the destination stream as a complete copy of the source stream.
This function can be useful when several compression strategies will be tried, for example when there are several ways of pre-processing the input data with a filter. The streams that will be discarded should then be freed by calling deflateEnd. Note that deflateCopy duplicates the internal compression state which can be quite large, so this strategy is slow and can consume lots of memory.
deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc being Z_NULL). msg is left unchanged in both source and destination.
Types ¶
type GzFile ¶
type GzFile = *GzFileS
semi-opaque gzip file descriptor
func Gzdopen ¶
Associate a gzFile with the file descriptor fd. File descriptors are obtained from calls like open, dup, creat, pipe or fileno (if the file has been previously opened with fopen). The mode parameter is as in gzopen. An 'e' in mode will set fd's flag to close the file on an execve() call. An 'N' in mode will set fd's non-blocking flag.
The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, mode);. The duplicated descriptor should be saved to avoid a leak, since gzdopen does not close fd if it fails. If you are using fileno() to get the file descriptor from a FILE *, then you will have to use dup() to avoid double-close()ing the file descriptor. Both gzclose() and fclose() will close the associated file descriptor, so they need to have different file descriptors.
gzdopen returns NULL if there was insufficient memory to allocate the gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided), or if fd is -1. The file descriptor is not used until the next gz* read, write, seek, or close operation, so gzdopen will not detect if fd is invalid (unless fd is -1).
func (GzFile) Buffer ¶
Set the internal buffer size used by this library's functions for file to size. The default buffer size is 8192 bytes. This function must be called after gzopen() or gzdopen(), and before any other calls that read or write the file. The buffer memory allocation is always deferred to the first read or write. Three times that size in buffer space is allocated. A larger buffer size of, for example, 64K or 128K bytes will noticeably increase the speed of decompression (reading).
The new buffer size also affects the maximum length for gzprintf().
gzbuffer() returns 0 on success, or -1 on failure, such as being called too late.
llgo:link GzFile.Buffer C.gzbuffer
type GzFileS ¶
gzgetc() macro and its supporting function and exposed data structure. Note that the real internal state is much larger than the exposed structure. This abbreviated structure exposes just enough for the gzgetc() macro. The user should not mess with these exposed elements, since their names or behavior could change in the future, perhaps even capriciously. They can only be used by the gzgetc() macro. You have been warned.
type Streamp ¶
type Streamp = *Stream
func (Streamp) DeflateBound ¶
llgo:link Streamp.DeflateBound C.deflateBound
func (Streamp) DeflateBoundZ ¶
deflateBound() returns an upper bound on the compressed size after deflation of sourceLen bytes. It must be called after deflateInit() or deflateInit2(), and after deflateSetHeader(), if used. This would be used to allocate an output buffer for deflation in a single pass, and so would be called before deflate(). If that first deflate() call is provided the sourceLen input bytes, an output buffer allocated to the size returned by deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed to return Z_STREAM_END. Note that it is possible for the compressed size to be larger than the value returned by deflateBound() if flush options other than Z_FINISH or Z_NO_FLUSH are used.
delfateBound_z() is the same, but takes and returns a size_t length. Note that a long is 32 bits on Windows.
llgo:link Streamp.DeflateBoundZ C.deflateBound_z
func (Streamp) DeflateInit ¶
llgo:link Streamp.DeflateInit C._llcppg_deflateInit
func (Streamp) DeflateInit2 ¶
func (self Streamp) DeflateInit2(level c.Int, method c.Int, windowBits c.Int, memLevel c.Int, strategy c.Int) c.Int
llgo:link Streamp.DeflateInit2 C._llcppg_deflateInit2
func (Streamp) DeflateInit2_ ¶
func (self Streamp) DeflateInit2_(level c.Int, method c.Int, windowBits c.Int, memLevel c.Int, strategy c.Int, version *c.Char, stream_size c.Int) c.Int
llgo:link Streamp.DeflateInit2_ C.deflateInit2_
func (Streamp) DeflateInit_ ¶
deflateInit and inflateInit are macros to allow checking the zlib version and the compiler's view of z_stream:
llgo:link Streamp.DeflateInit_ C.deflateInit_
func (Streamp) DeflateReset ¶
This function is equivalent to deflateEnd followed by deflateInit, but does not free and reallocate the internal compression state. The stream will leave the compression level and any other attributes that may have been set unchanged. total_in, total_out, adler, and msg are initialized.
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL).
llgo:link Streamp.DeflateReset C.deflateReset
func (Streamp) InflateBackInit ¶
llgo:link Streamp.InflateBackInit C._llcppg_inflateBackInit
func (Streamp) InflateBackInit_ ¶
func (self Streamp) InflateBackInit_(windowBits c.Int, window *uint8, version *c.Char, stream_size c.Int) c.Int
llgo:link Streamp.InflateBackInit_ C.inflateBackInit_
func (Streamp) InflateInit ¶
llgo:link Streamp.InflateInit C._llcppg_inflateInit
func (Streamp) InflateInit2 ¶
llgo:link Streamp.InflateInit2 C._llcppg_inflateInit2
func (Streamp) InflateInit2_ ¶
llgo:link Streamp.InflateInit2_ C.inflateInit2_