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_IO_FILTERINPUTSTREAM_H_ 00019 #define _DECAF_IO_FILTERINPUTSTREAM_H_ 00020 00021 #include <decaf/io/InputStream.h> 00022 #include <decaf/io/IOException.h> 00023 #include <decaf/lang/exceptions/NullPointerException.h> 00024 #include <decaf/lang/exceptions/IndexOutOfBoundsException.h> 00025 00026 namespace decaf{ 00027 namespace io{ 00028 00038 class DECAF_API FilterInputStream: public InputStream { 00039 protected: 00040 00041 // The input stream to wrap 00042 InputStream* inputStream; 00043 00044 // Indicates if we own the wrapped stream 00045 bool own; 00046 00047 // Indicates that this stream was closed 00048 volatile bool closed; 00049 00050 private: 00051 00052 FilterInputStream(const FilterInputStream&); 00053 FilterInputStream& operator=(const FilterInputStream&); 00054 00055 public: 00056 00065 FilterInputStream(InputStream* inputStream, bool own = false); 00066 00067 virtual ~FilterInputStream(); 00068 00072 virtual int available() const; 00073 00077 virtual void close(); 00078 00082 virtual long long skip(long long num); 00083 00087 virtual void mark(int readLimit); 00088 00092 virtual void reset(); 00093 00097 virtual bool markSupported() const; 00098 00099 protected: 00100 00101 virtual int doReadByte(); 00102 00103 virtual int doReadArray(unsigned char* buffer, int size); 00104 00105 virtual int doReadArrayBounded(unsigned char* buffer, int size, int offset, int length); 00106 00110 virtual bool isClosed() const; 00111 00112 }; 00113 00114 }} 00115 00116 #endif /*_DECAF_IO_FILTERINPUTSTREAM_H_*/
1.6.1