activemq-cpp-3.8.2
BufferedInputStream.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_IO_BUFFEREDINPUTSTREAM_H_
19 #define _DECAF_IO_BUFFEREDINPUTSTREAM_H_
20 
21 #include <decaf/util/Config.h>
24 
25 namespace decaf{
26 namespace io{
27 
35  private:
36 
37  int pos;
38  int count;
39  int markLimit;
40  int markPos;
41  int bufferSize;
42  unsigned char* buff;
43 
44  // Proxy to the actual buffer, when NULL it signals this stream is closed.
45  // the actual buffer is deleted in the destructor.
46  unsigned char* proxyBuffer;
47 
48  private:
49 
51  BufferedInputStream& operator=(const BufferedInputStream&);
52 
53  public:
54 
63  BufferedInputStream(InputStream* stream, bool own = false);
64 
77  BufferedInputStream(InputStream* stream, int bufferSize, bool own = false);
78 
79  virtual ~BufferedInputStream();
80 
84  virtual int available() const;
85 
89  virtual void close();
90 
94  virtual long long skip(long long num);
95 
99  virtual void mark(int readLimit);
100 
104  virtual void reset();
105 
109  virtual bool markSupported() const {
110  return true;
111  }
112 
113  protected:
114 
115  virtual int doReadByte();
116 
117  virtual int doReadArrayBounded(unsigned char* buffer, int size, int offset, int length);
118 
119  private:
120 
121  int bufferData(InputStream* stream, unsigned char*& buffer);
122 
123  };
124 
125 }}
126 
127 #endif /*_DECAF_IO_BUFFEREDINPUTSTREAM_H_*/
virtual bool markSupported() const
Determines if this input stream supports the mark and reset methods.Whether or not mark and reset are...
Definition: BufferedInputStream.h:109
A base class that must be implemented by all classes wishing to provide a class that reads in a strea...
Definition: InputStream.h:39
A wrapper around another input stream that performs a buffered read, where it reads more data than it...
Definition: BufferedInputStream.h:34
A FilterInputStream contains some other input stream, which it uses as its basic source of data...
Definition: FilterInputStream.h:38
#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