activemq-cpp-3.8.2
Reader.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_READER_H
18 #define _DECAF_IO_READER_H
19 
20 #include <string>
21 #include <decaf/lang/Readable.h>
22 #include <decaf/io/Closeable.h>
23 #include <decaf/io/IOException.h>
24 #include <decaf/io/InputStream.h>
25 
28 
29 namespace decaf{
30 namespace io{
31 
32  /*
33  * Abstract class for reading character streams. The only methods that a subclass
34  * must implement are read( char*, size_t, size_t ) and close(). Most subclasses,
35  * however, will override some of the methods defined here in order to provide
36  * higher efficiency, additional functionality, or both.
37  *
38  * @since 1.0
39  */
40  class DECAF_API Reader: public virtual decaf::io::Closeable, public virtual decaf::lang::Readable {
41  private:
42 
43  Reader(const Reader&);
44  Reader& operator=(const Reader&);
45 
46  protected:
47 
48  Reader();
49 
50  public:
51 
52  virtual ~Reader();
53 
65  virtual void mark(int readAheadLimit);
66 
73  virtual bool markSupported() const {
74  return false;
75  }
76 
85  virtual bool ready() const;
86 
96  virtual void reset();
97 
109  virtual long long skip(long long count);
110 
122  virtual int read(std::vector<char>& buffer);
123 
139  virtual int read(char* buffer, int size);
140 
160  virtual int read(char* buffer, int size, int offset, int length);
161 
174  virtual int read();
175 
176  virtual int read(decaf::nio::CharBuffer* charBuffer);
177 
178  protected:
179 
187  virtual int doReadArrayBounded(char* buffer, int size, int offset, int length) = 0;
188 
189  protected:
190 
195  virtual int doReadVector(std::vector<char>& buffer);
196 
201  virtual int doReadArray(char* buffer, int length);
202 
207  virtual int doReadChar();
208 
213  virtual int doReadCharBuffer(decaf::nio::CharBuffer* charBuffer);
214 
215  };
216 
217 }}
218 
219 #endif /*_DECAF_IO_READER_H*/
Definition: Reader.h:40
Interface for a class that implements the close method.
Definition: Closeable.h:30
This class defines four categories of operations upon character buffers:
Definition: CharBuffer.h:65
virtual bool markSupported() const
Tells whether this stream supports the mark() operation.
Definition: Reader.h:73
#define DECAF_API
Definition: Config.h:29
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25
A Readable is a source of characters.
Definition: Readable.h:39