activemq-cpp-3.8.2
ByteArrayInputStream.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_BYTEARRAYINPUTSTREAM_H_
19 #define _DECAF_IO_BYTEARRAYINPUTSTREAM_H_
20 
21 #include <decaf/io/InputStream.h>
23 #include <vector>
24 
25 namespace decaf{
26 namespace io{
27 
43  private:
44 
50  const unsigned char* buffer;
51 
55  int size;
56 
60  bool own;
61 
68  int count;
69 
75  int pos;
76 
86  int markpos;
87 
88  private:
89 
91  ByteArrayInputStream& operator=(const ByteArrayInputStream&);
92 
93  public:
94 
100 
108  ByteArrayInputStream(const std::vector<unsigned char>& buffer);
109 
124  ByteArrayInputStream(const unsigned char* buffer, int bufferSize, bool own = false);
125 
144  ByteArrayInputStream(const unsigned char* buffer, int bufferSize, int offset, int length, bool own = false);
145 
146  virtual ~ByteArrayInputStream();
147 
159  virtual void setByteArray(const std::vector<unsigned char>& buffer);
160 
173  virtual void setByteArray(const unsigned char* buffer, int bufferSize);
174 
191  virtual void setByteArray(const unsigned char* buffer, int bufferSize, int offset, int length);
192 
196  virtual int available() const;
197 
201  virtual long long skip(long long num);
202 
206  virtual void mark(int readLimit);
207 
211  virtual void reset();
212 
216  virtual bool markSupported() const {
217  return true;
218  }
219 
220  protected:
221 
222  virtual int doReadByte();
223 
224  virtual int doReadArrayBounded(unsigned char* buffer, int size, int offset, int length);
225 
226  };
227 
228 }}
229 
230 #endif /*_DECAF_IO_BYTEARRAYINPUTSTREAM_H_*/
virtual bool markSupported() const
Determines if this input stream supports the mark and reset methods.Whether or not mark and reset are...
Definition: ByteArrayInputStream.h:216
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 ByteArrayInputStream contains an internal buffer that contains bytes that may be read from the stre...
Definition: ByteArrayInputStream.h:42
#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