Apache log4cxx  Version 0.11.0
bytearrayinputstream.h
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 _LOG4CXX_HELPERS_BYTEARRAYINPUTSTREAM_H
19 #define _LOG4CXX_HELPERS_BYTEARRAYINPUTSTREAM_H
20 
21 #if defined(_MSC_VER)
22  #pragma warning ( push )
23  #pragma warning ( disable: 4231 4251 4275 4786 )
24 #endif
25 
26 
27 #include <vector>
28 #include <log4cxx/helpers/inputstream.h>
29 
30 
31 namespace log4cxx
32 {
33 
34 namespace helpers
35 {
36 LOG4CXX_LIST_DEF(ByteList, unsigned char);
37 
41 class LOG4CXX_EXPORT ByteArrayInputStream : public InputStream
42 {
43  private:
44  ByteList buf;
45  size_t pos;
46 
47  public:
48  DECLARE_ABSTRACT_LOG4CXX_OBJECT(ByteArrayInputStream)
49  BEGIN_LOG4CXX_CAST_MAP()
50  LOG4CXX_CAST_ENTRY(ByteArrayInputStream)
51  LOG4CXX_CAST_ENTRY_CHAIN(InputStream)
52  END_LOG4CXX_CAST_MAP()
53 
54 
59  ByteArrayInputStream(const ByteList& bytes);
60 
61  virtual ~ByteArrayInputStream();
62 
67  virtual void close();
68 
76  virtual int read(ByteBuffer& buf);
77 
78  private:
79 
81 
82  ByteArrayInputStream& operator=(const ByteArrayInputStream&);
83 
84 };
85 
86 LOG4CXX_PTR_DEF(ByteArrayInputStream);
87 } // namespace helpers
88 
89 } //namespace log4cxx
90 
91 #if defined(_MSC_VER)
92  #pragma warning ( pop )
93 #endif
94 
95 #endif //_LOG4CXX_HELPERS_BYTEARRAYINPUTSTREAM_H
InputStream implemented on top of a byte array.
Definition: bytearrayinputstream.h:41
Abstract class for reading from character streams.
Definition: inputstream.h:34
A byte buffer.
Definition: bytebuffer.h:33
Definition: appender.h:33