activemq-cpp-3.8.2
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 
24 namespace decaf {
25 namespace io {
26 
27  class OutputStream;
28 
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 
51  OutputStreamWriter& operator=(const OutputStreamWriter&);
52 
53  public:
54 
66  OutputStreamWriter(OutputStream* stream, bool own = false);
67 
68  virtual ~OutputStreamWriter();
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_ */
A class for turning a character stream into a byte stream.
Definition: OutputStreamWriter.h:36
Definition: Writer.h:41
#define DECAF_API
Definition: Config.h:29
Base interface for any class that wants to represent an output stream of bytes.
Definition: OutputStream.h:39
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25