00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _DECAF_IO_WRITER_H
00018 #define _DECAF_IO_WRITER_H
00019
00020 #include <string>
00021 #include <vector>
00022 #include <decaf/io/IOException.h>
00023 #include <decaf/io/Closeable.h>
00024 #include <decaf/io/Flushable.h>
00025 #include <decaf/lang/Appendable.h>
00026 #include <decaf/lang/exceptions/NullPointerException.h>
00027 #include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
00028
00029 namespace decaf{
00030 namespace io{
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 class DECAF_API Writer: public decaf::io::Closeable, public decaf::io::Flushable, public decaf::lang::Appendable {
00042 private:
00043
00044 Writer(const Writer&);
00045 Writer& operator=(const Writer&);
00046
00047 public:
00048
00049 Writer();
00050
00051 virtual ~Writer();
00052
00061 virtual void write(char v);
00062
00071 virtual void write(const std::vector<char>& buffer);
00072
00084 virtual void write(const char* buffer, int size);
00085
00102 virtual void write(const char* buffer, int size, int offset, int length);
00103
00112 virtual void write(const std::string& str);
00113
00127 virtual void write(const std::string& str, int offset, int length);
00128
00129 virtual decaf::lang::Appendable& append(char value);
00130
00131 virtual decaf::lang::Appendable& append(const decaf::lang::CharSequence* csq);
00132
00133 virtual decaf::lang::Appendable& append(const decaf::lang::CharSequence* csq, int start, int end);
00134
00135 protected:
00136
00144 virtual void doWriteArrayBounded(const char* buffer, int size, int offset, int length) = 0;
00145
00146 protected:
00147
00148 virtual void doWriteChar(char v);
00149
00150 virtual void doWriteVector(const std::vector<char>& buffer);
00151
00152 virtual void doWriteArray(const char* buffer, int size);
00153
00154 virtual void doWriteString(const std::string& str);
00155
00156 virtual void doWriteStringBounded(const std::string& str, int offset, int length);
00157
00158 virtual decaf::lang::Appendable& doAppendChar(char value);
00159
00160 virtual decaf::lang::Appendable& doAppendCharSequence(const decaf::lang::CharSequence* csq);
00161
00162 virtual decaf::lang::Appendable& doAppendCharSequenceStartEnd(const decaf::lang::CharSequence* csq, int start, int end);
00163
00164 };
00165
00166 }}
00167
00168 #endif