proxygen
ZlibStreamDecompressor.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree. An additional grant
7  * of patent rights can be found in the PATENTS file in the same directory.
8  *
9  */
10 #pragma once
11 
12 #include <memory>
13 #include <zlib.h>
15 
16 namespace folly {
17 class IOBuf;
18 }
19 
20 DECLARE_int64(zlib_decompresser_buffer_growth);
21 DECLARE_int64(zlib_decompresser_buffer_minsize);
22 
23 namespace proxygen {
24 
25 enum class ZlibCompressionType: int {
26  NONE = 0,
27  DEFLATE = 15,
28  GZIP = 31
29 };
30 
32  public:
34 
36 
38 
39  void init(ZlibCompressionType type);
40 
41  std::unique_ptr<folly::IOBuf> decompress(const folly::IOBuf* in);
42 
43  int getStatus() { return status_; }
44 
45  bool hasError() { return status_ != Z_OK && status_ != Z_STREAM_END; }
46 
47  bool finished() { return status_ == Z_STREAM_END; }
48 
49  private:
51  z_stream zlibStream_;
52  int status_{-1};
53 };
54 
55 
56 }
PskType type
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
void init(int *argc, char ***argv, bool removeFlags)
Definition: Init.cpp:34
Type type_
Definition: JSONSchema.cpp:208
DECLARE_int64(zlib_decompresser_buffer_growth)