#include <google/protobuf/io/gzip_stream.h>
namespace google::protobuf::io
This file contains the definition for classes GzipInputStream and GzipOutputStream.
GzipInputStream decompresses data from an underlying ZeroCopyInputStream and provides the decompressed data as a ZeroCopyInputStream.
GzipOutputStream is an ZeroCopyOutputStream that compresses data to an underlying ZeroCopyOutputStream.
Classes in this file | |
|---|---|
A ZeroCopyInputStream that reads compressed data through zlib. | |
#include <google/protobuf/io/gzip_stream.h>
namespace google::protobuf::io
A ZeroCopyInputStream that reads compressed data through zlib.
Members | |
|---|---|
enum | FormatFormat key for constructor. more... |
explicit | GzipInputStream(ZeroCopyInputStream * sub_stream, Format format = AUTO, int buffer_size = -1)buffer_size and format may be -1 for default of 64kB and GZIP format |
virtual | ~GzipInputStream() |
const char * | ZlibErrorMessage() constReturn last error message or NULL if no error. |
int | ZlibErrorCode() const |
implements ZeroCopyInputStream | |
virtual bool | Next(const void ** data, int * size)Obtains a chunk of data from the stream. more... |
virtual void | BackUp(int count) |
virtual bool | Skip(int count)Skips a number of bytes. more... |
virtual int64 | ByteCount() constReturns the total number of bytes read since this object was created. |
enum GzipInputStream::Format {
AUTO = 0,
GZIP = 1,
ZLIB = 2
}Format key for constructor.
| AUTO | zlib will autodetect gzip header or deflate stream |
| GZIP | GZIP streams have some extra header data for file attributes. |
| ZLIB | Simpler zlib stream format. |
virtual bool GzipInputStream::Next(
const void ** data,
int * size)Obtains a chunk of data from the stream.
Preconditions:
Postconditions:
virtual void GzipInputStream::BackUp(
int count)Backs up a number of bytes, so that the next call to Next() returns data again that was already returned by the last call to Next().
This is useful when writing procedures that are only supposed to read up to a certain point in the input, then return. If Next() returns a buffer that goes beyond what you wanted to read, you can use BackUp() to return to the point where you intended to finish.
Preconditions:
Postconditions:
virtual bool GzipInputStream::Skip(
int count)Skips a number of bytes.
Returns false if the end of the stream is reached or some input error occurred. In the end-of-stream case, the stream is advanced to the end of the stream (so ByteCount() will return the total size of the stream).
#include <google/protobuf/io/gzip_stream.h>
namespace google::protobuf::io
Members | |
|---|---|
enum | FormatFormat key for constructor. more... |
explicit | GzipOutputStream(ZeroCopyOutputStream * sub_stream)Create a GzipOutputStream with default options. |
| GzipOutputStream(ZeroCopyOutputStream * sub_stream, const Options & options)Create a GzipOutputStream with the given options. |
| GzipOutputStream(ZeroCopyOutputStream * sub_stream, Format format, int buffer_size = -1)DEPRECATED: Use one of the above constructors instead. |
virtual | ~GzipOutputStream() |
const char * | ZlibErrorMessage() constReturn last error message or NULL if no error. |
int | ZlibErrorCode() const |
bool | Flush()Flushes data written so far to zipped data in the underlying stream. more... |
bool | Close()Writes out all data and closes the gzip stream. more... |
implements ZeroCopyOutputStream | |
bool | Next(void ** data, int * size) |
void | BackUp(int count) |
int64 | ByteCount() const |
enum GzipOutputStream::Format {
GZIP = 1,
ZLIB = 2
}Format key for constructor.
| GZIP | GZIP streams have some extra header data for file attributes. |
| ZLIB | Simpler zlib stream format. |
bool GzipOutputStream::Flush()Flushes data written so far to zipped data in the underlying stream.
It is the caller's responsibility to flush the underlying stream if necessary. Compression may be less efficient stopping and starting around flushes. Returns true if no error.
bool GzipOutputStream::Close()Writes out all data and closes the gzip stream.
It is the caller's responsibility to close the underlying stream if necessary. Returns true if no error.
#include <google/protobuf/io/gzip_stream.h>
namespace google::protobuf::io
Members | |
|---|---|
Format | formatDefaults to GZIP. |
int | buffer_sizeWhat size buffer to use internally. Defaults to 64kB. |
int | compression_levelA number between 0 and 9, where 0 is no compression and 9 is best compression. more... |
int | compression_strategyDefaults to Z_DEFAULT_STRATEGY. more... |
| Options()Initializes with default values. |
intOptions::compression_levelA number between 0 and 9, where 0 is no compression and 9 is best compression.
Defaults to Z_DEFAULT_COMPRESSION (see zlib.h).
intOptions::compression_strategyDefaults to Z_DEFAULT_STRATEGY.
Can also be set to Z_FILTERED, Z_HUFFMAN_ONLY, or Z_RLE. See the documentation for deflateInit2 in zlib.h for definitions of these constants.