class StreamingChunkedCompressor
Defined at line 43 of file ../../src/lib/chunked-compression/streaming-chunked-compressor.h
StreamingChunkedCompressor creates compressed archives by reading a stream of data which has
a known size ahead of time.
Usage (error checks omitted):
size_t input_data_sz = InputDataSize();
StreamingChunkedCompressor compressor;
size_t output_limit = compressor.ComputeOutputSizeLimit(input_data_sz);
fbl::Array
<uint8
_t> output_buffer(new uint8_t[output_limit], output_limit);
compressor.Init(input_data_sz, output_buffer.get(), output_buffer.size());
uint8_t input_buffer[ReadBufferSize()];
size_t bytes_in_buffer;
while ((bytes_in_buffer = ReadInput(input_buffer, sizeof(input_buffer)))) {
compressor.Update(input_buffer, bytes_in_buffer);
}
size_t compressed_size;
compressor.Final(
&compressed
_size);
Public Methods
void StreamingChunkedCompressor ()
Defined at line 30 of file ../../src/lib/chunked-compression/streaming-chunked-compressor.cc
void StreamingChunkedCompressor (CompressionParams params)
Defined at line 33 of file ../../src/lib/chunked-compression/streaming-chunked-compressor.cc
void ~StreamingChunkedCompressor ()
Defined at line 39 of file ../../src/lib/chunked-compression/streaming-chunked-compressor.cc
void StreamingChunkedCompressor (StreamingChunkedCompressor && o)
Defined at line 41 of file ../../src/lib/chunked-compression/streaming-chunked-compressor.cc
StreamingChunkedCompressor & operator= (StreamingChunkedCompressor && o)
Defined at line 45 of file ../../src/lib/chunked-compression/streaming-chunked-compressor.cc
void StreamingChunkedCompressor (const StreamingChunkedCompressor & )
Defined at line 50 of file ../../src/lib/chunked-compression/streaming-chunked-compressor.h
StreamingChunkedCompressor & operator= (const StreamingChunkedCompressor & )
Defined at line 50 of file ../../src/lib/chunked-compression/streaming-chunked-compressor.h
size_t ComputeOutputSizeLimit (size_t len)
Returns the minimum size that a buffer must be to hold the result of compressing |len| bytes.
Defined at line 53 of file ../../src/lib/chunked-compression/streaming-chunked-compressor.h
Status Init (size_t stream_len, void * output, size_t output_len)
Initializes the compressor to prepare to receive |stream_len| bytes of input data.
The compressed data will be written to |output|. |output_len| must be at least
|ComputeOutputSizeLimit(stream_len)| bytes.
If |Init| is invoked while compression is ongoing, the context of the previous compression is
reset and the previous output buffer is left in an undefined state.
Defined at line 71 of file ../../src/lib/chunked-compression/streaming-chunked-compressor.cc
void SetProgressCallback (ProgressFn callback)
Defined at line 82 of file ../../src/lib/chunked-compression/streaming-chunked-compressor.h
const CompressionParams & params ()
Defined at line 84 of file ../../src/lib/chunked-compression/streaming-chunked-compressor.h
Status Update (const void * input, size_t input_len)
Processes exactly |input_len| bytes of input data, read from |input|.
If |input_len| bytes would take the streaming compressor past the end of the expected data
length (i.e. the |stream_len| parameter to the previous call to |Init|), then an error is
returned.
Defined at line 113 of file ../../src/lib/chunked-compression/streaming-chunked-compressor.cc
Status Final (size_t * compressed_size_out)
Finalizes the compressed archive, returning its size in |compressed_size_out|.
|Final| must be called before the compressed archive is usable, and |Final| must only
be called after the entire input has been processed.
The compressor is reusable after |Final| is called by invoking |Init| again.
Defined at line 141 of file ../../src/lib/chunked-compression/streaming-chunked-compressor.cc