activemq-cpp-3.9.5
DataOutputStream.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_DATAOUTPUTSTREAM_H_
19#define _DECAF_IO_DATAOUTPUTSTREAM_H_
20
24#include <string>
25
26namespace decaf{
27namespace io{
28
34 class DECAF_API DataOutputStream: public FilterOutputStream {
35 protected:
36
37 // The number of bytes written to the data output stream so far.
38 long long written;
39
40 // Buffer used for storing byte values to write to the stream
41 unsigned char buffer[8];
42
43 private:
44
45 DataOutputStream(const DataOutputStream&);
46 DataOutputStream& operator=(const DataOutputStream&);
47
48 public:
49
57
59
67 virtual long long size() const {
68 return written;
69 }
70
74 virtual void writeBoolean(bool value);
75
79 virtual void writeByte(unsigned char value);
80
84 virtual void writeShort(short value);
85
89 virtual void writeUnsignedShort(unsigned short value);
90
94 virtual void writeChar(char value);
95
99 virtual void writeInt(int value);
100
104 virtual void writeLong(long long value);
105
109 virtual void writeFloat(float value);
110
114 virtual void writeDouble(double value);
115
119 virtual void writeBytes(const std::string& value);
120
124 virtual void writeChars(const std::string& value);
125
129 virtual void writeUTF(const std::string& value);
130
131 protected:
132
133 virtual void doWriteByte(unsigned char value);
134
135 virtual void doWriteArrayBounded(const unsigned char* buffer, int size, int offset, int length);
136
137 private:
138
139 // Determine the encoded length of a string when written as modified UTF-8
140 unsigned int countUTFLength(const std::string& value);
141
142 };
143
144}}
145
146#endif /*_DECAF_IO_DATAOUTPUTSTREAM_H_*/
virtual void writeChar(char value)
virtual void writeFloat(float value)
virtual void writeByte(unsigned char value)
virtual void writeBytes(const std::string &value)
virtual void writeInt(int value)
virtual void writeShort(short value)
virtual void writeLong(long long value)
virtual void writeDouble(double value)
DataOutputStream(OutputStream *outputStream, bool own=false)
Creates a new data output stream to write data to the specified underlying output stream.
unsigned char buffer[8]
Definition DataOutputStream.h:41
virtual void doWriteByte(unsigned char value)
virtual void writeUnsignedShort(unsigned short value)
virtual void doWriteArrayBounded(const unsigned char *buffer, int size, int offset, int length)
virtual void writeChars(const std::string &value)
virtual long long size() const
Returns the current value of the counter written, the number of bytes written to this data output str...
Definition DataOutputStream.h:67
virtual void writeUTF(const std::string &value)
long long written
Definition DataOutputStream.h:38
virtual void writeBoolean(bool value)
bool own
Definition FilterOutputStream.h:56
OutputStream * outputStream
Definition FilterOutputStream.h:53
Base interface for any class that wants to represent an output stream of bytes.
Definition OutputStream.h:39
#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