activemq-cpp-3.3.0

src/main/decaf/util/zip/InflaterInputStream.h

Go to the documentation of this file.
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_UTIL_ZIP_INFLATERINPUTSTREAM_H_
00019 #define _DECAF_UTIL_ZIP_INFLATERINPUTSTREAM_H_
00020 
00021 #include <decaf/util/Config.h>
00022 
00023 #include <decaf/io/FilterInputStream.h>
00024 #include <decaf/io/IOException.h>
00025 #include <decaf/util/zip/Inflater.h>
00026 
00027 #include <vector>
00028 
00029 namespace decaf {
00030 namespace util {
00031 namespace zip {
00032 
00038     class DECAF_API InflaterInputStream : public decaf::io::FilterInputStream {
00039     protected:
00040 
00044         Inflater* inflater;
00045 
00049         std::vector<unsigned char> buff;
00050 
00054         int length;
00055 
00056         bool ownInflater;
00057         bool atEOF;
00058 
00059         static const int DEFAULT_BUFFER_SIZE;
00060 
00061     private:
00062 
00063         InflaterInputStream( const InflaterInputStream& );
00064         InflaterInputStream& operator= ( const InflaterInputStream& );
00065 
00066     public:
00067 
00076         InflaterInputStream( decaf::io::InputStream* inputStream, bool own = false );
00077 
00095         InflaterInputStream( decaf::io::InputStream* inputStream, Inflater* inflater,
00096                              bool own = false, bool ownInflater = false );
00097 
00118         InflaterInputStream( decaf::io::InputStream* inputStream, Inflater* inflater,
00119                              int bufferSize, bool own = false, bool ownInflater = false );
00120 
00121         virtual ~InflaterInputStream();
00122 
00128         virtual int available() const;
00129 
00135         virtual void close();
00136 
00142         virtual long long skip( long long num );
00143 
00149         virtual void mark( int readLimit );
00150 
00156         virtual void reset();
00157 
00163         virtual bool markSupported() const;
00164 
00165     protected:
00166 
00172         virtual void fill();
00173 
00174     protected:
00175 
00176         virtual int doReadByte();
00177 
00178         virtual int doReadArrayBounded( unsigned char* buffer, int size, int offset, int length );
00179 
00180     };
00181 
00182 }}}
00183 
00184 #endif /* _DECAF_UTIL_ZIP_INFLATERINPUTSTREAM_H_ */