diff options
Diffstat (limited to 'Minecraft.World/ByteArrayOutputStream.h')
| -rw-r--r-- | Minecraft.World/ByteArrayOutputStream.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Minecraft.World/ByteArrayOutputStream.h b/Minecraft.World/ByteArrayOutputStream.h new file mode 100644 index 00000000..9e0b498d --- /dev/null +++ b/Minecraft.World/ByteArrayOutputStream.h @@ -0,0 +1,29 @@ +#pragma once + +#include "OutputStream.h" + +class ByteArrayOutputStream : public OutputStream +{ +// Note - when actually implementing, byteArray will need to grow as data is written +public: + byteArray buf; //The buffer where data is stored. + +protected: + unsigned int count; //The number of valid bytes in the buffer. + +public: + ByteArrayOutputStream(); + ByteArrayOutputStream(unsigned int size); + virtual ~ByteArrayOutputStream(); + + virtual void flush() {} + virtual void write(unsigned int b); + virtual void write(byteArray b); + virtual void write(byteArray b, unsigned int offset, unsigned int length); + virtual void close(); + virtual byteArray toByteArray(); + + void reset() { count = 0; } + unsigned int size() { return count; } + +};
\ No newline at end of file |
