ZStreamW Class Reference
[Streams]

Base interface for write streams. More...

#include <ZStream.h>

Inheritance diagram for ZStreamW:

ZStreamRW_FIFO ZStreamRW_FlushOnRead ZStreamRW_MemoryPipe ZStreamW_Base64Encode ZStreamW_Buffered ZStreamW_Count ZStreamW_DynamicBuffered ZStreamW_HexStrim ZStreamW_Limited ZStreamW_LZWDecode ZStreamW_LZWEncode ZStreamW_LZWEncodeNoPatent ZStreamW_MD5 ZStreamW_Memory ZStreamW_Null ZStreamW_SHA1 ZStreamW_Tee ZStreamWPos List of all members.

Public Member Functions

Write raw data
Write data from memory into this stream.

void Write (const void *iSource, size_t iCount) const
 Write to the stream the iCount bytes starting at the address iSource.
void Write (const void *iSource, size_t iCount, size_t *oCountWritten) const
 Write to the stream the iCount bytes starting at the address iSource, returning the count actually written.
Copy from
Read data from iStreamR and write it to this stream.

void CopyAllFrom (const ZStreamR &iStreamR) const
 Read data from iStreamR and write it to this stream until one or the other reaches its end.
void CopyAllFrom (const ZStreamR &iStreamR, uint64 *oCountRead, uint64 *oCountWritten) const
 Read data from iStreamR and write it to this stream until one or other reaches its end.
void CopyFrom (const ZStreamR &iStreamR, uint64 iCount) const
 Read data from iStreamR and write it to this stream.
void CopyFrom (const ZStreamR &iStreamR, uint64 iCount, uint64 *oCountRead, uint64 *oCountWritten) const
 Read data from iStreamR and write it to this stream.
Write formatted data
Write data to the stream in standard formats.

void WriteInt8 (int8 iVal) const
void WriteInt16 (int16 iVal) const
void WriteInt32 (int32 iVal) const
void WriteInt64 (int64 iVal) const
void WriteFloat (float iVal) const
void WriteDouble (double iVal) const
void WriteInt16LE (int16 iVal) const
void WriteInt32LE (int32 iVal) const
void WriteInt64LE (int64 iVal) const
void WriteFloatLE (float iVal) const
void WriteDoubleLE (double iVal) const
void WriteBool (bool iVal) const
void WriteUInt8 (uint8 iVal) const
void WriteUInt16 (uint16 iVal) const
void WriteUInt32 (uint32 iVal) const
void WriteUInt64 (uint64 iVal) const
void WriteUInt16LE (uint16 iVal) const
void WriteUInt32LE (uint32 iVal) const
void WriteUInt64LE (uint64 iVal) const
void WriteString (const char *iString) const
void WriteString (const std::string &iString) const
size_t Writef (const char *iString,...) const
Useful variants
Write single bytes without exceptions being thrown.

bool WriteByte (uint8 iVal) const
Flushing potentially buffered data
void Flush () const
 If this stream buffers data then pass it on to its ultimate destination.
Essential overrides
All ZStreamW functionality is implemented by calling this method.

virtual void Imp_Write (const void *iSource, size_t iCount, size_t *oCountWritten)=0
Optionally overridable API
Default implementations that directly or indirectly call ZStreamW::Imp_Write are provided, but particular subclasses may have more efficient implementations available.

virtual void Imp_CopyFromDispatch (const ZStreamR &iStreamR, uint64 iCount, uint64 *oCountRead, uint64 *oCountWritten)
 Invoke iStreamR's Imp_CopyTo method.
virtual void Imp_CopyFrom (const ZStreamR &iStreamR, uint64 iCount, uint64 *oCountRead, uint64 *oCountWritten)
 Actually copy data to this stream from iStreamR.
virtual void Imp_Flush ()

Protected Member Functions

Canonical Methods
The canonical methods are protected, thus you cannot create, destroy or assign through a ZStreamW reference, you must work with some derived class.

 ZStreamW ()
 ~ZStreamW ()
 ZStreamW (const ZStreamW &)
ZStreamWoperator= (const ZStreamW &)

Detailed Description

Base interface for write streams.


Member Function Documentation

void ZStreamW::Write ( const void *  iSource,
size_t  iCount 
) const

Write to the stream the iCount bytes starting at the address iSource.

Parameters:
iSource The address in memory from which data should be read. It is the caller's responsibility to ensure that iSource to iSource + 1 are allocated and readable.
iCount The number of bytes to write.
If iCount bytes cannot be written to the stream an end of write stream exception will be thrown.

void ZStreamW::Write ( const void *  iSource,
size_t  iCount,
size_t *  oCountWritten 
) const

Write to the stream the iCount bytes starting at the address iSource, returning the count actually written.

Parameters:
iSource The address in memory from which data should be read. It is the caller's responsibility to ensure that iSource to iSource + 1 are allocated and readable.
iCount The number of bytes to write.
oCountWritten (optional output) The number of bytes actually written. If iCount is non zero and oCountWritten is zero this indicates that the stream has reached its end.

void ZStreamW::CopyAllFrom ( const ZStreamR iStreamR,
uint64 oCountRead,
uint64 oCountWritten 
) const

Read data from iStreamR and write it to this stream until one or other reaches its end.

Parameters:
iStreamR The stream from which data should be read.
iCount The number of bytes to be read from iStreamR and written to this stream.
oCountRead (optional output) The number of bytes that were actually read.
oCountWritten (optional output) The number of bytes that were actually written.
oCountWritten will be less than or equal to oCountRead.

void ZStreamW::CopyFrom ( const ZStreamR iStreamR,
uint64  iCount 
) const

Read data from iStreamR and write it to this stream.

Parameters:
iStreamR The stream from which data should be read.
iCount The number of bytes to be read from iStreamR and written to this stream.
If iCount bytes could not be read then an end of read stream exception is thrown. If iCount bytes could not be written then an end of write stream exception is thrown.

void ZStreamW::CopyFrom ( const ZStreamR iStreamR,
uint64  iCount,
uint64 oCountRead,
uint64 oCountWritten 
) const

Read data from iStreamR and write it to this stream.

Parameters:
iStreamR The stream from which data should be read.
iCount The number of bytes to be read from iStreamR and written to this stream.
oCountRead (optional output) The number of bytes that were actually read.
oCountWritten (optional output) The number of bytes that were actually written.

void ZStreamW::WriteInt8 ( int8  iVal  )  const

Write a single byte to the stream. May throw an end of write stream exception.

void ZStreamW::WriteInt16 ( int16  iVal  )  const

Write a 16 bit integer to the stream in big endian order. May throw an end of write stream exception.

void ZStreamW::WriteInt32 ( int32  iVal  )  const

Write a 32 bit integer to the stream in big endian order. May throw an end of write stream exception.

void ZStreamW::WriteInt64 ( int64  iVal  )  const

Write a 64 bit integer to the stream in big endian order. May throw an end of write stream exception.

void ZStreamW::WriteFloat ( float  iVal  )  const

Write a floating point number to the stream in a big endian IEEE754 single precision format. May throw an end of write stream exception.

void ZStreamW::WriteDouble ( double  iVal  )  const

Write a floating point number to the stream in a big endian IEEE754 double precision format. May throw an end of write stream exception.

void ZStreamW::WriteInt16LE ( int16  iVal  )  const

Write a 16 bit integer to the stream in little endian order. May throw an end of write stream exception.

void ZStreamW::WriteInt32LE ( int32  iVal  )  const

Write a 32 bit integer to the stream in little endian order. May throw an end of write stream exception.

void ZStreamW::WriteInt64LE ( int64  iVal  )  const

Write a 64 bit integer to the stream in little endian order. May throw an end of write stream exception.

void ZStreamW::WriteFloatLE ( float  iVal  )  const

Write a floating point number to the stream in a little endian IEEE754 single precision format. May throw an end of write stream exception.

void ZStreamW::WriteDoubleLE ( double  iVal  )  const

Write a floating point number to the stream in a little endian IEEE754 double precision format. May throw an end of write stream exception.

void ZStreamW::WriteBool ( bool  iVal  )  const

Write a non-zero byte to the stream if iVal is true, otherwise write a zero byte. May throw an end of write stream exception.

void ZStreamW::WriteString ( const char *  iString  )  const

Write the bytes pointed to by iString, up to but not including the terminating zero byte. May throw an end of write stream exception.

size_t ZStreamW::Writef ( const char *  iString,
  ... 
) const

Write the bytes pointed to by iString, up to but not including the terminating zero byte. Standard printf-style parameter substitution is applied to the string before writing. The number of bytes successfully written is returned.

bool ZStreamW::WriteByte ( uint8  iVal  )  const

Write a single byte to the stream. If the stream reached its end return false, otherwise return true.

void ZStreamW::Flush (  )  const

If this stream buffers data then pass it on to its ultimate destination.

Some write streams buffer the data written to them, or are built atop a foundation that may buffer data. Such streams should override Imp_Flush and push that buffered data on to its ultimate destination. When the method returns the data may still not have reached its ultimate destination, but is guaranteed to do at some point in the future with no further action necessary on the caller's part.

void ZStreamW::Imp_CopyFromDispatch ( const ZStreamR iStreamR,
uint64  iCount,
uint64 oCountRead,
uint64 oCountWritten 
) [virtual]

Invoke iStreamR's Imp_CopyTo method.

The first part of the two-stage dispatch initiated by ZStreamW::CopyFrom and ZStreamW::CopyAllFrom. Override if your stream's data is in memory and thus iStreamR can have its Read method called with your stream's data as its destination.

Reimplemented in ZStreamW_Null, ZStreamWPos_Null, ZStreamW_DynamicBuffered, ZStreamW_Count, ZStreamW_Memory, ZStreamWPos_Memory, ZStreamRW_FlushOnRead, and ZStreamRW_MemoryPipe.

void ZStreamW::Imp_CopyFrom ( const ZStreamR iStreamR,
uint64  iCount,
uint64 oCountRead,
uint64 oCountWritten 
) [virtual]

Actually copy data to this stream from iStreamR.

The second part of the two-stage dispatch initiated by ZStreamR::CopyTo and ZStreamR::CopyAllTo. The default implementation calls sCopyReadToWrite. Override this method if your stream's data is in memory and thus can be modified by calling iStreamR's Read method.

See also:
sCopyReadToWrite

Reimplemented in ZStreamW_Null, ZStreamWPos_Null, ZStreamW_DynamicBuffered, ZStreamW_Count, ZStreamW_Memory, ZStreamWPos_Memory, ZStreamRW_FlushOnRead, and ZStreamRW_MemoryPipe.


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