activemq-cpp-3.9.5
OutputStreamWriter.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_OUTPUTSTREAMWRITER_H_
19#define _DECAF_IO_OUTPUTSTREAMWRITER_H_
20
21#include <decaf/util/Config.h>
22#include <decaf/io/Writer.h>
23
24namespace decaf {
25namespace io {
26
27 class OutputStream;
28
36 class DECAF_API OutputStreamWriter: public Writer {
37 private:
38
39 // Pointer to the Stream this Writer writes its data to.
40 OutputStream* stream;
41
42 // Does this class own the output stream.
43 bool own;
44
45 // Closed flag
46 volatile bool closed;
47
48 private:
49
50 OutputStreamWriter(const OutputStreamWriter&);
51 OutputStreamWriter& operator=(const OutputStreamWriter&);
52
53 public:
54
66 OutputStreamWriter(OutputStream* stream, bool own = false);
67
69
70 virtual void close();
71
72 virtual void flush();
73
74 protected:
75
76 virtual void doWriteArrayBounded(const char* buffer, int size, int offset, int length);
77
78 // Used to check state and throw error when closed.
79 virtual void checkClosed() const;
80
81 };
82
83}}
84
85#endif /* _DECAF_IO_OUTPUTSTREAMWRITER_H_ */
Base interface for any class that wants to represent an output stream of bytes.
Definition OutputStream.h:39
virtual void checkClosed() const
virtual void doWriteArrayBounded(const char *buffer, int size, int offset, int length)
Override this method to customize the functionality of the method write( char* buffer,...
virtual void close()
Closes this object and deallocates the appropriate resources.
virtual void flush()
Flushes this stream by writing any buffered output to the underlying stream.
OutputStreamWriter(OutputStream *stream, bool own=false)
Creates a new OutputStreamWriter.
#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