22
snappy.h
22
snappy.h
@@ -78,8 +78,10 @@ namespace snappy {
|
||||
|
||||
// Compress the bytes read from "*reader" and append to "*writer". Return the
|
||||
// number of bytes written.
|
||||
// First version is to preserve ABI.
|
||||
size_t Compress(Source* reader, Sink* writer);
|
||||
size_t Compress(Source* reader, Sink* writer,
|
||||
CompressionOptions options = {});
|
||||
CompressionOptions options);
|
||||
|
||||
// Find the uncompressed length of the given stream, as given by the header.
|
||||
// Note that the true length could deviate from this; the stream could e.g.
|
||||
@@ -98,16 +100,22 @@ namespace snappy {
|
||||
// Original contents of *compressed are lost.
|
||||
//
|
||||
// REQUIRES: "input[]" is not an alias of "*compressed".
|
||||
// First version is to preserve ABI.
|
||||
size_t Compress(const char* input, size_t input_length,
|
||||
std::string* compressed, CompressionOptions options = {});
|
||||
std::string* compressed);
|
||||
size_t Compress(const char* input, size_t input_length,
|
||||
std::string* compressed, CompressionOptions options);
|
||||
|
||||
// Same as `Compress` above but taking an `iovec` array as input. Note that
|
||||
// this function preprocesses the inputs to compute the sum of
|
||||
// `iov[0..iov_cnt-1].iov_len` before reading. To avoid this, use
|
||||
// `RawCompressFromIOVec` below.
|
||||
// First version is to preserve ABI.
|
||||
size_t CompressFromIOVec(const struct iovec* iov, size_t iov_cnt,
|
||||
std::string* compressed);
|
||||
size_t CompressFromIOVec(const struct iovec* iov, size_t iov_cnt,
|
||||
std::string* compressed,
|
||||
CompressionOptions options = {});
|
||||
CompressionOptions options);
|
||||
|
||||
// Decompresses "compressed[0..compressed_length-1]" to "*uncompressed".
|
||||
// Original contents of "*uncompressed" are lost.
|
||||
@@ -151,14 +159,18 @@ namespace snappy {
|
||||
// ... Process(output, output_length) ...
|
||||
// delete [] output;
|
||||
void RawCompress(const char* input, size_t input_length, char* compressed,
|
||||
size_t* compressed_length, CompressionOptions options = {});
|
||||
size_t* compressed_length);
|
||||
void RawCompress(const char* input, size_t input_length, char* compressed,
|
||||
size_t* compressed_length, CompressionOptions options);
|
||||
|
||||
// Same as `RawCompress` above but taking an `iovec` array as input. Note that
|
||||
// `uncompressed_length` is the total number of bytes to be read from the
|
||||
// elements of `iov` (_not_ the number of elements in `iov`).
|
||||
void RawCompressFromIOVec(const struct iovec* iov, size_t uncompressed_length,
|
||||
char* compressed, size_t* compressed_length);
|
||||
void RawCompressFromIOVec(const struct iovec* iov, size_t uncompressed_length,
|
||||
char* compressed, size_t* compressed_length,
|
||||
CompressionOptions options = {});
|
||||
CompressionOptions options);
|
||||
|
||||
// Given data in "compressed[0..compressed_length-1]" generated by
|
||||
// calling the Snappy::Compress routine, this routine
|
||||
|
||||
Reference in New Issue
Block a user