blob: 9e0b498d738310a706e0d86e2bf80f00530918a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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; }
};
|