activemq-cpp-3.9.5
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
23#include <vector>
24
25namespace decaf{
26namespace io{
27
42 class DECAF_API ByteArrayInputStream: public InputStream {
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
90 ByteArrayInputStream(const ByteArrayInputStream&);
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
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 void setByteArray(const unsigned char *buffer, int bufferSize)
Sets the data that this reader uses, replaces any existing data and resets to beginning of the buffer...
ByteArrayInputStream(const unsigned char *buffer, int bufferSize, bool own=false)
Create an instance of the ByteArrayInputStream with the given buffer as the source of input for all r...
ByteArrayInputStream(const unsigned char *buffer, int bufferSize, int offset, int length, bool own=false)
Create an instance of the ByteArrayInputStream with the given buffer as the source of input for all r...
virtual void setByteArray(const unsigned char *buffer, int bufferSize, int offset, int length)
Sets the data that this reader uses, replaces any existing data and resets to beginning of the buffer...
virtual int doReadArrayBounded(unsigned char *buffer, int size, int offset, int length)
virtual long long skip(long long num)
Skips over and discards n bytes of data from this input stream.The skip method may,...
ByteArrayInputStream(const std::vector< unsigned char > &buffer)
Creates the input stream and calls setBuffer with the specified buffer object.
virtual void reset()
Repositions this stream to the position at the time the mark method was last called on this input str...
virtual void setByteArray(const std::vector< unsigned char > &buffer)
Sets the internal buffer.
ByteArrayInputStream()
Creates an ByteArrayInputStream with an empty input buffer, the buffer can be initialized with a call...
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
virtual int available() const
Indicates the number of bytes available.The default implementation of this methods returns 0....
virtual void mark(int readLimit)
Marks the current position in the stream A subsequent call to the reset method repositions this strea...
#define DECAF_API
Definition Config.h:29
Definition BlockingByteArrayInputStream.h:25
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25