Tianjie Xu | 4d10c3e | 2017-10-26 14:02:06 -0700 | [diff] [blame] | 1 | // Copyright 2017 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef _BSDIFF_BROTLI_DECOMPRESSOR_H_ |
| 6 | #define _BSDIFF_BROTLI_DECOMPRESSOR_H_ |
| 7 | |
| 8 | #include <brotli/decode.h> |
| 9 | |
| 10 | #include "bsdiff/decompressor_interface.h" |
| 11 | |
| 12 | namespace bsdiff { |
| 13 | |
| 14 | class BrotliDecompressor : public DecompressorInterface { |
| 15 | public: |
| 16 | BrotliDecompressor() |
| 17 | : brotli_decoder_state_(nullptr), next_in_(nullptr), available_in_(0) {} |
Alex Deymo | c2ae7a5 | 2018-03-12 19:23:35 +0100 | [diff] [blame] | 18 | ~BrotliDecompressor(); |
Tianjie Xu | 4d10c3e | 2017-10-26 14:02:06 -0700 | [diff] [blame] | 19 | |
| 20 | // DecompressorInterface overrides. |
| 21 | bool SetInputData(const uint8_t* input_data, size_t size) override; |
| 22 | bool Read(uint8_t* output_data, size_t bytes_to_output) override; |
| 23 | bool Close() override; |
| 24 | |
| 25 | private: |
| 26 | BrotliDecoderState* brotli_decoder_state_; |
| 27 | const uint8_t* next_in_; |
| 28 | size_t available_in_; |
| 29 | }; |
| 30 | |
| 31 | } // namespace bsdiff |
| 32 | |
Alex Deymo | 9bb4ddb | 2018-02-14 16:30:54 +0100 | [diff] [blame] | 33 | #endif // _BSDIFF_BROTLI_DECOMPRESSOR_H_ |