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 SRC_INCLUDE_PUFFIN_PUFFER_H_ 6 #define SRC_INCLUDE_PUFFIN_PUFFER_H_ 7 8 #include <memory> 9 #include <vector> 10 11 #include "puffin/common.h" 12 #include "puffin/errors.h" 13 #include "puffin/stream.h" 14 15 namespace puffin { 16 17 class BitReaderInterface; 18 class PuffWriterInterface; 19 class HuffmanTable; 20 21 class PUFFIN_EXPORT Puffer { 22 public: 23 Puffer(); 24 ~Puffer(); 25 26 // Creates a puffed buffer from a deflate buffer. If |deflates| is not null, 27 // it will be populated with the location of subblocks in the input data. 28 bool PuffDeflate(BitReaderInterface* br, 29 PuffWriterInterface* pw, 30 std::vector<BitExtent>* deflates, 31 Error* error) const; 32 33 private: 34 std::unique_ptr<HuffmanTable> dyn_ht_; 35 std::unique_ptr<HuffmanTable> fix_ht_; 36 37 DISALLOW_COPY_AND_ASSIGN(Puffer); 38 }; 39 40 } // namespace puffin 41 42 #endif // SRC_INCLUDE_PUFFIN_PUFFER_H_ 43