|
activemq-cpp-3.4.0
|
00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef _DECAF_UTI_ZIP_DEFLATER_H_ 00019 #define _DECAF_UTI_ZIP_DEFLATER_H_ 00020 00021 #include <decaf/util/Config.h> 00022 00023 #include <decaf/lang/exceptions/NullPointerException.h> 00024 #include <decaf/lang/exceptions/IllegalArgumentException.h> 00025 #include <decaf/lang/exceptions/IllegalStateException.h> 00026 #include <decaf/lang/exceptions/IndexOutOfBoundsException.h> 00027 00028 #include <vector> 00029 00030 namespace decaf { 00031 namespace util { 00032 namespace zip { 00033 00034 class DeflaterData; 00035 00052 class DECAF_API Deflater { 00053 public: 00054 00058 static const int BEST_SPEED; 00059 00063 static const int BEST_COMPRESSION; 00064 00068 static const int DEFAULT_COMPRESSION; 00069 00073 static const int DEFLATED; 00074 00078 static const int NO_COMPRESSION; 00079 00085 static const int FILTERED; 00086 00090 static const int HUFFMAN_ONLY; 00091 00095 static const int DEFAULT_STRATEGY; 00096 00097 private: 00098 00099 // Class internal data used during compression. 00100 DeflaterData* data; 00101 00102 private: 00103 00104 Deflater( const Deflater& ); 00105 Deflater operator= ( const Deflater& ); 00106 00107 public: 00108 00119 Deflater( int level, bool nowrap = false ); 00120 00125 Deflater(); 00126 00127 virtual ~Deflater(); 00128 00146 void setInput( const unsigned char* buffer, int size, int offset, int length ); 00147 00162 void setInput( const std::vector<unsigned char>& buffer, int offset, int length ); 00163 00173 void setInput( const std::vector<unsigned char>& buffer ); 00174 00194 void setDictionary( const unsigned char* buffer, int size, int offset, int length ); 00195 00212 void setDictionary( const std::vector<unsigned char>& buffer, int offset, int length ); 00213 00225 void setDictionary( const std::vector<unsigned char>& buffer ); 00226 00236 void setStrategy( int strategy ); 00237 00247 void setLevel( int level ); 00248 00253 bool needsInput() const; 00254 00259 void finish(); 00260 00264 bool finished() const; 00265 00286 int deflate( unsigned char* buffer, int size, int offset, int length ); 00287 00305 int deflate( std::vector<unsigned char>& buffer, int offset, int length ); 00306 00319 int deflate( std::vector<unsigned char>& buffer ); 00320 00326 long long getAdler() const; 00327 00333 long long getBytesRead() const; 00334 00340 long long getBytesWritten() const; 00341 00348 void reset(); 00349 00355 void end(); 00356 00357 }; 00358 00359 }}} 00360 00361 #endif /* _DECAF_UTI_ZIP_DEFLATER_H_ */