| 39 | #include <string.h> |
| 40 | |
| 41 | class ByteStreamOutArray : public ByteStreamOut |
| 42 | { |
| 43 | public: |
| 44 | ByteStreamOutArray(I64 alloc=4096); |
| 45 | /* write a single byte */ |
| 46 | BOOL putByte(U8 byte); |
| 47 | /* write an array of bytes */ |
| 48 | BOOL putBytes(const U8* bytes, U32 num_bytes); |
| 49 | /* is the stream seekable (e.g. standard out is not) */ |
| 50 | BOOL isSeekable() const; |
| 51 | /* get current position of stream */ |
| 52 | I64 tell() const; |
| 53 | /* seek to this position in the stream */ |
| 54 | BOOL seek(const I64 position); |
| 55 | /* seek to the end of the file */ |
| 56 | BOOL seekEnd(); |
| 57 | /* destructor */ |
| 58 | ~ByteStreamOutArray() { if (data) free(data); }; |
| 59 | /* get access to data */ |
| 60 | inline I64 getSize() const { return size; }; |
| 61 | inline I64 getCurr() const { return curr; }; |
| 62 | inline const U8* getData() const { return data; }; |
| 63 | inline U8* takeData() { U8* d = data; data = 0; alloc = 0; size = 0; curr = 0; return d; }; |
| 64 | protected: |
| 65 | U8* data; |
| 66 | I64 alloc; |
| 67 | I64 size; |
| 68 | I64 curr; |
| 69 | }; |
| 70 | |
| 71 | class ByteStreamOutArrayLE : public ByteStreamOutArray |
| 72 | { |
nothing calls this directly
no outgoing calls
no test coverage detected