activemq-cpp-3.9.5
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>
25
28
29namespace decaf{
30namespace 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
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*/
Interface for a class that implements the close method.
Definition Closeable.h:30
virtual void mark(int readAheadLimit)
Marks the present position in the stream.
virtual int read(char *buffer, int size, int offset, int length)
Reads characters into a portion of an array.
virtual int read(char *buffer, int size)
Reads characters into an array, the method will attempt to read as much data as the size of the array...
virtual int doReadVector(std::vector< char > &buffer)
Override this method to customize the functionality of the method read( std::vector<char>& buffer ).
virtual int doReadArray(char *buffer, int length)
Override this method to customize the functionality of the method read( char* buffer,...
virtual int doReadCharBuffer(decaf::nio::CharBuffer *charBuffer)
Override this method to customize the functionality of the method read( CharBuffer* charBuffer ).
virtual int doReadChar()
Override this method to customize the functionality of the method read().
virtual int read()
Reads a single character.
virtual void reset()
Resets the stream.
virtual bool ready() const
Tells whether this stream is ready to be read.
virtual int read(std::vector< char > &buffer)
Reads characters into an array.
virtual long long skip(long long count)
Skips characters.
virtual bool markSupported() const
Tells whether this stream supports the mark() operation.
Definition Reader.h:73
virtual int doReadArrayBounded(char *buffer, int size, int offset, int length)=0
Override this method to customize the functionality of the method read( unsigned char* buffer,...
virtual int read(decaf::nio::CharBuffer *charBuffer)
Attempts to read characters into the specified character buffer.
A Readable is a source of characters.
Definition Readable.h:39
This class defines four categories of operations upon character buffers:
Definition CharBuffer.h:68
#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