Ignore:
Timestamp:
28/04/2007 18:11:36 (5 years ago)
Author:
chris
Message:

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

File:
1 copied

Legend:

Unmodified
Added
Removed
  • box/chris/merge/lib/common/ZeroStream.h

    r1263 r1585  
    22// 
    33// File 
    4 //              Name:    BufferedStream.h 
    5 //              Purpose: Buffering wrapper around IOStreams 
    6 //              Created: 2007/01/16 
     4//              Name:    ZeroStream.h 
     5//              Purpose: An IOStream which returns all zeroes up to a certain size 
     6//              Created: 2007/04/28 
    77// 
    88// -------------------------------------------------------------------------- 
    99 
    10 #ifndef BUFFEREDSTREAM__H 
    11 #define BUFFEREDSTREAM__H 
     10#ifndef ZEROSTREAM__H 
     11#define ZEROSTREAM__H 
    1212 
    1313#include "IOStream.h" 
    1414 
    15 class BufferedStream : public IOStream 
     15class ZeroStream : public IOStream 
    1616{ 
    1717private: 
    18         IOStream& mrSource; 
    19         char mBuffer[4096]; 
    20         int  mBufferSize; 
    21         int  mBufferPosition; 
     18        IOStream::pos_type mSize, mPosition; 
    2219 
    2320public: 
    24         BufferedStream(IOStream& rSource); 
     21        ZeroStream(IOStream::pos_type mSize); 
    2522         
    2623        virtual int Read(void *pBuffer, int NBytes, int Timeout = IOStream::TimeOutInfinite); 
     
    3532 
    3633private: 
    37         BufferedStream(const BufferedStream &rToCopy)  
    38         : mrSource(rToCopy.mrSource) { /* do not call */ } 
     34        ZeroStream(const ZeroStream &rToCopy); 
    3935}; 
    4036 
    41 #endif // BUFFEREDSTREAM__H 
     37#endif // ZEROSTREAM__H 
    4238 
    4339 
Note: See TracChangeset for help on using the changeset viewer.