summaryrefslogtreecommitdiff
path: root/lib/common/MemBlockStream.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common/MemBlockStream.h')
-rw-r--r--lib/common/MemBlockStream.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/common/MemBlockStream.h b/lib/common/MemBlockStream.h
index 5234525b..1ba4b0a6 100644
--- a/lib/common/MemBlockStream.h
+++ b/lib/common/MemBlockStream.h
@@ -10,10 +10,10 @@
#ifndef MEMBLOCKSTREAM__H
#define MEMBLOCKSTREAM__H
+#include "CollectInBufferStream.h"
#include "IOStream.h"
class StreamableMemBlock;
-class CollectInBufferStream;
// --------------------------------------------------------------------------
//
@@ -29,6 +29,7 @@ class MemBlockStream : public IOStream
public:
MemBlockStream();
MemBlockStream(const void *pBuffer, int Size);
+ MemBlockStream(const std::string& rMessage);
MemBlockStream(const StreamableMemBlock &rBlock);
MemBlockStream(const CollectInBufferStream &rBuffer);
MemBlockStream(const MemBlockStream &rToCopy);
@@ -37,7 +38,8 @@ public:
virtual int Read(void *pBuffer, int NBytes, int Timeout = IOStream::TimeOutInfinite);
virtual pos_type BytesLeftToRead();
- virtual void Write(const void *pBuffer, int NBytes);
+ virtual void Write(const void *pBuffer, int NBytes,
+ int Timeout = IOStream::TimeOutInfinite);
virtual pos_type GetPosition() const;
virtual void Seek(pos_type Offset, int SeekType);
virtual bool StreamDataLeft();
@@ -46,6 +48,9 @@ public:
virtual int GetSize() const { return mBytesInBuffer; }
private:
+ // Use mTempBuffer when we need to hold a copy of the memory block,
+ // and free it ourselves when done.
+ CollectInBufferStream mTempBuffer;
const char *mpBuffer;
int mBytesInBuffer;
int mReadPosition;