blob: f78ff8e62718ca5078ae1573df048d090eefa0a5 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// --------------------------------------------------------------------------
//
// File
// Name: MemBlockStream.h
// Purpose: Stream out data from any memory block
// Created: 2003/09/05
//
// --------------------------------------------------------------------------
#ifndef MEMBLOCKSTREAM__H
#define MEMBLOCKSTREAM__H
#include "IOStream.h"
class StreamableMemBlock;
class CollectInBufferStream;
// --------------------------------------------------------------------------
//
// Class
// Name: MemBlockStream
// Purpose: Stream out data from any memory block -- be careful the lifetime
// of the block is greater than the lifetime of this stream.
// Created: 2003/09/05
//
// --------------------------------------------------------------------------
class MemBlockStream : public IOStream
{
public:
MemBlockStream(const void *pBuffer, int Size);
MemBlockStream(const StreamableMemBlock &rBlock);
MemBlockStream(const CollectInBufferStream &rBuffer);
MemBlockStream(const MemBlockStream &rToCopy);
~MemBlockStream();
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 pos_type GetPosition() const;
virtual void Seek(pos_type Offset, int SeekType);
virtual bool StreamDataLeft();
virtual bool StreamClosed();
private:
const char *mpBuffer;
int mBytesInBuffer;
int mReadPosition;
};
#endif // MEMBLOCKSTREAM__H
|