activemq-cpp-3.9.5
BytesMessage.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 _CMS_BYTESMESSAGE_H_
19#define _CMS_BYTESMESSAGE_H_
20
21#include <cms/Config.h>
22#include <cms/Message.h>
23
24#include <cms/CMSException.h>
29
30namespace cms {
31
66 class CMS_API BytesMessage : public Message {
67 public:
68
69 virtual ~BytesMessage();
70
82 virtual void setBodyBytes(const unsigned char* buffer, int numBytes) = 0;
83
96 virtual unsigned char* getBodyBytes() const = 0;
97
106 virtual int getBodyLength() const = 0;
107
115 virtual void reset() = 0;
116
126 virtual bool readBoolean() const = 0;
127
140 virtual void writeBoolean(bool value) = 0;
141
152 virtual unsigned char readByte() const = 0;
153
164 virtual void writeByte(unsigned char value) = 0;
165
190 virtual int readBytes(std::vector<unsigned char>& value) const = 0;
191
203 virtual void writeBytes(const std::vector<unsigned char>& value) = 0;
204
236 virtual int readBytes(unsigned char* buffer, int length) const = 0;
237
253 virtual void writeBytes(const unsigned char* value, int offset, int length) = 0;
254
265 virtual char readChar() const = 0;
266
277 virtual void writeChar(char value) = 0;
278
289 virtual float readFloat() const = 0;
290
300 virtual void writeFloat(float value) = 0;
301
312 virtual double readDouble() const = 0;
313
323 virtual void writeDouble(double value) = 0;
324
335 virtual short readShort() const = 0;
336
347 virtual void writeShort(short value) = 0;
348
359 virtual unsigned short readUnsignedShort() const = 0;
360
371 virtual void writeUnsignedShort(unsigned short value) = 0;
372
383 virtual int readInt() const = 0;
384
395 virtual void writeInt(int value) = 0;
396
407 virtual long long readLong() const = 0;
408
419 virtual void writeLong(long long value) = 0;
420
431 virtual std::string readString() const = 0;
432
443 virtual void writeString(const std::string& value) = 0;
444
455 virtual std::string readUTF() const = 0;
456
467 virtual void writeUTF(const std::string& value) = 0;
468
476 virtual BytesMessage* clone() const = 0;
477
478 };
479}
480
481#endif /*_CMS_BYTESMESSAGE_H_*/
A BytesMessage object is used to send a message containing a stream of unsigned bytes.
Definition BytesMessage.h:66
virtual float readFloat() const =0
Reads a 32 bit float from the Bytes message stream.
virtual bool readBoolean() const =0
Reads a Boolean from the Bytes message stream.
virtual double readDouble() const =0
Reads a 64 bit double from the Bytes message stream.
virtual unsigned char * getBodyBytes() const =0
Gets the bytes that are contained in this message and returns them in a newly allocated array that be...
virtual void writeShort(short value)=0
Writes a signed short to the bytes message stream as a 2 byte value.
virtual void writeDouble(double value)=0
Writes a double to the bytes message stream as a 8 byte value.
virtual long long readLong() const =0
Reads a 64 bit long from the Bytes message stream.
virtual int readBytes(unsigned char *buffer, int length) const =0
Reads a portion of the bytes message stream.
virtual void writeUTF(const std::string &value)=0
Writes an UTF String to the BytesMessage stream.
virtual void writeByte(unsigned char value)=0
Writes a byte to the bytes message stream as a 1-byte value.
virtual char readChar() const =0
Reads a Char from the Bytes message stream.
virtual void writeBytes(const unsigned char *value, int offset, int length)=0
Writes a portion of a byte array to the bytes message stream.
virtual unsigned char readByte() const =0
Reads a Byte from the Bytes message stream.
virtual void writeFloat(float value)=0
Writes a float to the bytes message stream as a 4 byte value.
virtual std::string readUTF() const =0
Reads an UTF String from the BytesMessage stream.
virtual void writeChar(char value)=0
Writes a char to the bytes message stream as a 1-byte value.
virtual void writeInt(int value)=0
Writes a signed int to the bytes message stream as a 4 byte value.
virtual int readBytes(std::vector< unsigned char > &value) const =0
Reads a byte array from the bytes message stream.
virtual void reset()=0
Puts the message body in read-only mode and repositions the stream of bytes to the beginning.
virtual void setBodyBytes(const unsigned char *buffer, int numBytes)=0
sets the bytes given to the message body.
virtual void writeUnsignedShort(unsigned short value)=0
Writes a unsigned short to the bytes message stream as a 2 byte value.
virtual unsigned short readUnsignedShort() const =0
Reads a 16 bit unsigned short from the Bytes message stream.
virtual int readInt() const =0
Reads a 32 bit signed integer from the Bytes message stream.
virtual std::string readString() const =0
Reads an ASCII String from the Bytes message stream.
virtual void writeBoolean(bool value)=0
Writes a boolean to the bytes message stream as a 1-byte value.
virtual int getBodyLength() const =0
Returns the number of bytes contained in the body of this message.
virtual short readShort() const =0
Reads a 16 bit signed short from the Bytes message stream.
virtual void writeLong(long long value)=0
Writes a long long to the bytes message stream as a 8 byte value.
virtual void writeString(const std::string &value)=0
Writes an ASCII String to the Bytes message stream.
virtual ~BytesMessage()
virtual void writeBytes(const std::vector< unsigned char > &value)=0
Writes a byte array to the bytes message stream using the vector size as the number of bytes to write...
virtual BytesMessage * clone() const =0
Clones this message.
Root of all messages.
Definition Message.h:88
#define CMS_API
Definition Config.h:31
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition DestinationResolver.h:23