static const size_t DEFAULT_BUF_SIZE = 8192;
-BufferedInStream::BufferedInStream(size_t bufSize_)
- : bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
+BufferedInStream::BufferedInStream()
+ : bufSize(DEFAULT_BUF_SIZE), offset(0)
{
ptr = end = start = new U8[bufSize];
}
U8* start;
protected:
- BufferedInStream(size_t bufSize=0);
+ BufferedInStream();
};
} // end of namespace rdr
static const size_t DEFAULT_BUF_SIZE = 16384;
-BufferedOutStream::BufferedOutStream(size_t bufSize_)
- : bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
+BufferedOutStream::BufferedOutStream()
+ : bufSize(DEFAULT_BUF_SIZE), offset(0)
{
ptr = start = sentUpTo = new U8[bufSize];
end = start + bufSize;
U8* sentUpTo;
protected:
- BufferedOutStream(size_t bufSize=0);
+ BufferedOutStream();
};
}
enum { DEFAULT_BUF_SIZE = 8192 };
-FdInStream::FdInStream(int fd_, int timeoutms_, size_t bufSize_,
+FdInStream::FdInStream(int fd_, int timeoutms_,
bool closeWhenDone_)
- : BufferedInStream(bufSize_),
- fd(fd_), closeWhenDone(closeWhenDone_),
+ : fd(fd_), closeWhenDone(closeWhenDone_),
timeoutms(timeoutms_), blockCallback(0),
timing(false), timeWaitedIn100us(5), timedKbits(0)
{
}
-FdInStream::FdInStream(int fd_, FdInStreamBlockCallback* blockCallback_,
- size_t bufSize_)
- : BufferedInStream(bufSize_),
- fd(fd_), timeoutms(0), blockCallback(blockCallback_),
+FdInStream::FdInStream(int fd_, FdInStreamBlockCallback* blockCallback_)
+ : fd(fd_), timeoutms(0), blockCallback(blockCallback_),
timing(false), timeWaitedIn100us(5), timedKbits(0)
{
}
public:
- FdInStream(int fd, int timeoutms=-1, size_t bufSize=0,
- bool closeWhenDone_=false);
- FdInStream(int fd, FdInStreamBlockCallback* blockCallback,
- size_t bufSize=0);
+ FdInStream(int fd, int timeoutms=-1, bool closeWhenDone_=false);
+ FdInStream(int fd, FdInStreamBlockCallback* blockCallback);
virtual ~FdInStream();
void setTimeout(int timeoutms);
using namespace rdr;
-FdOutStream::FdOutStream(int fd_, bool blocking_, int timeoutms_, size_t bufSize_)
- : BufferedOutStream(bufSize_),
- fd(fd_), blocking(blocking_), timeoutms(timeoutms_)
+FdOutStream::FdOutStream(int fd_, bool blocking_, int timeoutms_)
+ : fd(fd_), blocking(blocking_), timeoutms(timeoutms_)
{
gettimeofday(&lastWrite, NULL);
}
public:
- FdOutStream(int fd, bool blocking=true, int timeoutms=-1, size_t bufSize=0);
+ FdOutStream(int fd, bool blocking=true, int timeoutms=-1);
virtual ~FdOutStream();
void setTimeout(int timeoutms);
static inline int min(int a, int b) {return a<b ? a : b;}
-HexInStream::HexInStream(InStream& is, size_t bufSize_)
-: BufferedInStream(bufSize_), in_stream(is)
+HexInStream::HexInStream(InStream& is)
+: in_stream(is)
{
}
class HexInStream : public BufferedInStream {
public:
- HexInStream(InStream& is, size_t bufSize=0);
+ HexInStream(InStream& is);
virtual ~HexInStream();
static bool readHexAndShift(char c, int* v);
static inline size_t min(size_t a, size_t b) {return a<b ? a : b;}
-HexOutStream::HexOutStream(OutStream& os, size_t buflen)
-: out_stream(os), offset(0), bufSize(buflen ? buflen : DEFAULT_BUF_LEN)
+HexOutStream::HexOutStream(OutStream& os)
+ : out_stream(os), offset(0), bufSize(DEFAULT_BUF_LEN)
{
if (bufSize % 2)
bufSize--;
class HexOutStream : public OutStream {
public:
- HexOutStream(OutStream& os, size_t buflen=0);
+ HexOutStream(OutStream& os);
virtual ~HexOutStream();
void flush();
using namespace rdr;
-ZlibInStream::ZlibInStream(size_t bufSize_)
- : BufferedInStream(bufSize_),
- underlying(0), zs(NULL), bytesIn(0)
+ZlibInStream::ZlibInStream()
+ : underlying(0), zs(NULL), bytesIn(0)
{
init();
}
class ZlibInStream : public BufferedInStream {
public:
- ZlibInStream(size_t bufSize=0);
+ ZlibInStream();
virtual ~ZlibInStream();
void setUnderlying(InStream* is, size_t bytesIn);
enum { DEFAULT_BUF_SIZE = 16384 };
-ZlibOutStream::ZlibOutStream(OutStream* os, size_t bufSize_, int compressLevel)
+ZlibOutStream::ZlibOutStream(OutStream* os, int compressLevel)
: underlying(os), compressionLevel(compressLevel), newLevel(compressLevel),
- bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
+ bufSize(DEFAULT_BUF_SIZE), offset(0)
{
zs = new z_stream;
zs->zalloc = Z_NULL;
public:
- ZlibOutStream(OutStream* os=0, size_t bufSize=0, int compressionLevel=-1);
+ ZlibOutStream(OutStream* os=0, int compressionLevel=-1);
virtual ~ZlibOutStream();
void setUnderlying(OutStream* os);
ZRLEEncoder::ZRLEEncoder(SConnection* conn)
: Encoder(conn, encodingZRLE, EncoderPlain, 127),
- zos(0,0,zlibLevel), mos(129*1024)
+ zos(0,zlibLevel), mos(129*1024)
{
zos.setUnderlying(&mos);
}