activemq-cpp-3.8.2
Deflater.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _DECAF_UTI_ZIP_DEFLATER_H_
19 #define _DECAF_UTI_ZIP_DEFLATER_H_
20 
21 #include <decaf/util/Config.h>
22 
27 
28 #include <vector>
29 
30 namespace decaf {
31 namespace util {
32 namespace zip {
33 
34  class DeflaterData;
35 
53  public:
54 
58  static const int BEST_SPEED;
59 
63  static const int BEST_COMPRESSION;
64 
68  static const int DEFAULT_COMPRESSION;
69 
73  static const int DEFLATED;
74 
78  static const int NO_COMPRESSION;
79 
85  static const int FILTERED;
86 
90  static const int HUFFMAN_ONLY;
91 
95  static const int DEFAULT_STRATEGY;
96 
97  private:
98 
99  // Class internal data used during compression.
100  DeflaterData* data;
101 
102  private:
103 
104  Deflater( const Deflater& );
105  Deflater operator= ( const Deflater& );
106 
107  public:
108 
119  Deflater( int level, bool nowrap = false );
120 
125  Deflater();
126 
127  virtual ~Deflater();
128 
146  void setInput( const unsigned char* buffer, int size, int offset, int length );
147 
162  void setInput( const std::vector<unsigned char>& buffer, int offset, int length );
163 
173  void setInput( const std::vector<unsigned char>& buffer );
174 
194  void setDictionary( const unsigned char* buffer, int size, int offset, int length );
195 
212  void setDictionary( const std::vector<unsigned char>& buffer, int offset, int length );
213 
225  void setDictionary( const std::vector<unsigned char>& buffer );
226 
236  void setStrategy( int strategy );
237 
247  void setLevel( int level );
248 
253  bool needsInput() const;
254 
259  void finish();
260 
264  bool finished() const;
265 
286  int deflate( unsigned char* buffer, int size, int offset, int length );
287 
305  int deflate( std::vector<unsigned char>& buffer, int offset, int length );
306 
319  int deflate( std::vector<unsigned char>& buffer );
320 
326  long long getAdler() const;
327 
333  long long getBytesRead() const;
334 
340  long long getBytesWritten() const;
341 
348  void reset();
349 
355  void end();
356 
357  };
358 
359 }}}
360 
361 #endif /* _DECAF_UTI_ZIP_DEFLATER_H_ */
static const int BEST_SPEED
Compression level for fastest compression.
Definition: Deflater.h:58
static const int DEFAULT_COMPRESSION
Default compression level.
Definition: Deflater.h:68
static const int HUFFMAN_ONLY
Compression strategy for Huffman coding only.
Definition: Deflater.h:90
static const int DEFAULT_STRATEGY
Default compression strategy.
Definition: Deflater.h:95
static const int FILTERED
Compression strategy best used for data consisting mostly of small values with a somewhat random dist...
Definition: Deflater.h:85
static const int NO_COMPRESSION
Compression level for no compression.
Definition: Deflater.h:78
This class compresses data using the DEFLATE algorithm (see specification).
Definition: Deflater.h:52
static const int DEFLATED
Compression method for the deflate algorithm (the only one currently supported).
Definition: Deflater.h:73
static const int BEST_COMPRESSION
Compression level for best compression.
Definition: Deflater.h:63
#define DECAF_API
Definition: Config.h:29
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25