source: box/trunk/lib/common/ZeroStream.h @ 1585

Revision 1585, 939 bytes checked in by chris, 5 years ago (diff)

Add a stream which provides a source of zero bytes of arbitrary size,
useful for testing support for files over 2GB. (refs #3)

  • Property svn:eol-style set to native
Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    ZeroStream.h
5//              Purpose: An IOStream which returns all zeroes up to a certain size
6//              Created: 2007/04/28
7//
8// --------------------------------------------------------------------------
9
10#ifndef ZEROSTREAM__H
11#define ZEROSTREAM__H
12
13#include "IOStream.h"
14
15class ZeroStream : public IOStream
16{
17private:
18        IOStream::pos_type mSize, mPosition;
19
20public:
21        ZeroStream(IOStream::pos_type mSize);
22       
23        virtual int Read(void *pBuffer, int NBytes, int Timeout = IOStream::TimeOutInfinite);
24        virtual pos_type BytesLeftToRead();
25        virtual void Write(const void *pBuffer, int NBytes);
26        virtual pos_type GetPosition() const;
27        virtual void Seek(IOStream::pos_type Offset, int SeekType);
28        virtual void Close();
29       
30        virtual bool StreamDataLeft();
31        virtual bool StreamClosed();
32
33private:
34        ZeroStream(const ZeroStream &rToCopy);
35};
36
37#endif // ZEROSTREAM__H
38
39
Note: See TracBrowser for help on using the repository browser.