activemq-cpp-3.9.5
Writer.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#ifndef _DECAF_IO_WRITER_H
18#define _DECAF_IO_WRITER_H
19
20#include <string>
21#include <vector>
23#include <decaf/io/Closeable.h>
24#include <decaf/io/Flushable.h>
28
29namespace decaf{
30namespace io{
31
32 /*
33 * Abstract class for writing to character streams. The only methods that a
34 * subclass must implement are write( char*, size_t, size_t ), flush(), and
35 * close(). Most subclasses, however, will override some of the methods
36 * defined here in order to provide higher efficiency, additional functionality,
37 * or both.
38 *
39 * @since 1.0
40 */
42 private:
43
44 Writer(const Writer&);
45 Writer& operator=(const Writer&);
46
47 public:
48
50
51 virtual ~Writer();
52
61 virtual void write(char v);
62
71 virtual void write(const std::vector<char>& buffer);
72
84 virtual void write(const char* buffer, int size);
85
102 virtual void write(const char* buffer, int size, int offset, int length);
103
112 virtual void write(const std::string& str);
113
127 virtual void write(const std::string& str, int offset, int length);
128
129 virtual decaf::lang::Appendable& append(char value);
130
132
133 virtual decaf::lang::Appendable& append(const decaf::lang::CharSequence* csq, int start, int end);
134
135 protected:
136
144 virtual void doWriteArrayBounded(const char* buffer, int size, int offset, int length) = 0;
145
146 protected:
147
148 virtual void doWriteChar(char v);
149
150 virtual void doWriteVector(const std::vector<char>& buffer);
151
152 virtual void doWriteArray(const char* buffer, int size);
153
154 virtual void doWriteString(const std::string& str);
155
156 virtual void doWriteStringBounded(const std::string& str, int offset, int length);
157
159
161
163
164 };
165
166}}
167
168#endif /*_DECAF_IO_WRITER_H*/
Interface for a class that implements the close method.
Definition Closeable.h:30
A Flushable is a destination of data that can be flushed.
Definition Flushable.h:34
virtual decaf::lang::Appendable & append(const decaf::lang::CharSequence *csq, int start, int end)
Appends a subsequence of the specified character sequence to this Appendable.
virtual decaf::lang::Appendable & append(char value)
Appends the specified character to this Appendable.
virtual void write(const char *buffer, int size)
Writes a byte array to the output stream.
virtual decaf::lang::Appendable & doAppendCharSequenceStartEnd(const decaf::lang::CharSequence *csq, int start, int end)
virtual void doWriteString(const std::string &str)
virtual decaf::lang::Appendable & doAppendChar(char value)
virtual void write(const std::vector< char > &buffer)
Writes an array of Chars.
virtual void doWriteVector(const std::vector< char > &buffer)
virtual void write(const char *buffer, int size, int offset, int length)
Writes a byte array to the output stream.
virtual void doWriteArray(const char *buffer, int size)
virtual void write(char v)
Writes an single byte char value.
virtual decaf::lang::Appendable & doAppendCharSequence(const decaf::lang::CharSequence *csq)
virtual void write(const std::string &str, int offset, int length)
Writes a string.
virtual void doWriteArrayBounded(const char *buffer, int size, int offset, int length)=0
Override this method to customize the functionality of the method write( char* buffer,...
virtual void write(const std::string &str)
Writes a string.
virtual decaf::lang::Appendable & append(const decaf::lang::CharSequence *csq)
Appends the specified character sequence to this Appendable.
virtual void doWriteStringBounded(const std::string &str, int offset, int length)
virtual void doWriteChar(char v)
An object to which char sequences and values can be appended.
Definition Appendable.h:42
A CharSequence is a readable sequence of char values.
Definition CharSequence.h:36
#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