00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00023 #ifndef _CLASS_BYTEARRAYOUTPUTSTREAM_H
00024 #define _CLASS_BYTEARRAYOUTPUTSTREAM_H
00025
00026 #ifdef __cplusplus
00027
00028 #include "beecrypt/c++/mutex.h"
00029 using beecrypt::mutex;
00030 #include "beecrypt/c++/io/OutputStream.h"
00031 using beecrypt::io::OutputStream;
00032
00033 namespace beecrypt {
00034 namespace io {
00037 class BEECRYPTCXXAPI ByteArrayOutputStream : public OutputStream
00038 {
00039 private:
00040 mutex _lock;
00041
00042 protected:
00043 bytearray buf;
00044 size_t count;
00045
00046 public:
00047 ByteArrayOutputStream();
00048 ByteArrayOutputStream(size_t size);
00049 virtual ~ByteArrayOutputStream();
00050
00051 void reset() throw ();
00052 size_t size() throw ();
00053 bytearray* toByteArray();
00054 void toByteArray(bytearray& b);
00055 void toByteArray(byte* data, size_t offset, size_t length);
00056 void writeTo(OutputStream& out) throw (IOException);
00057
00058 virtual void close() throw (IOException);
00059 virtual void flush() throw (IOException);
00060 virtual void write(byte b) throw (IOException);
00061 virtual void write(const byte* data, size_t offset, size_t length) throw (IOException);
00062 virtual void write(const bytearray& b) throw (IOException);
00063 };
00064 }
00065 }
00066
00067 #endif
00068
00069 #endif