ZStreamR_Buffered Class Reference

A read filter stream that tries to pre-read data in chunks as large as its buffer size. More...

#include <ZStream_Buffered.h>

Inheritance diagram for ZStreamR_Buffered:

ZStreamR List of all members.

Public Member Functions

virtual size_t Imp_CountReadable ()
 Returns the number of bytes guaranteed to be readable without blocking.
virtual void Imp_Skip (uint64 iCount, uint64 *oCountSkipped)
 Read and discard iCount bytes.
void Abandon ()
 Discard any data residing in the buffer.

Detailed Description

A read filter stream that tries to pre-read data in chunks as large as its buffer size.

ZStreamR_Buffered filters its source stream by trying to read in chunks that are as large as the buffer size passed to its constructor. If the source stream's CountReadable method always returns zero then ZStreamR_Buffered will not be able to help out -- it relies on a usable answer from that method to read more data than is required to satisfy the current request, in order to be able to satisfy future requests from its buffer rather than by calling the source stream again. ZStreamR_Buffered is most useful to ameliorate poor performance caused by a source stream with high call overhead or latency.


Member Function Documentation

size_t ZStreamR_Buffered::Imp_CountReadable (  )  [virtual]

Returns the number of bytes guaranteed to be readable without blocking.

If the stream does not or cannot know this information it should return zero. A zero return thus does not mean no data is available, simply that a subsequent Read or Skip may block indefinitely.

Reimplemented from ZStreamR.

void ZStreamR_Buffered::Imp_Skip ( uint64  iCount,
uint64 oCountSkipped 
) [virtual]

Read and discard iCount bytes.

Override this method if your stream implementation can skip past bytes in the stream without actually reading them.

Parameters:
iCount Count of bytes to be skipped.
oCountSkipped Number of bytes that were actually skipped. If iCount is non zero and oCountSkipped is set to zero then this indicates that the stream has reached its end.

Reimplemented from ZStreamR.


The documentation for this class was generated from the following files:
Generated on Thu Jul 26 11:22:02 2007 for ZooLib by  doxygen 1.4.7