#include <ZStream.h>
Inheritance diagram for ZStreamR:
Public Member Functions | |
Read raw data | |
Read data from this stream into memory. | |
void | Read (void *iDest, size_t iCount) const |
Read iCount bytes into memory starting at iDest. | |
void | Read (void *iDest, size_t iCount, size_t *oCountRead) const |
Copy To | |
Read data from this stream and write it to iStreamW. | |
void | CopyAllTo (const ZStreamW &iStreamW) const |
Read data from this stream and write it to iStreamW until this stream reaches its end. | |
void | CopyAllTo (const ZStreamW &iStreamW, uint64 *oCountRead, uint64 *oCountWritten) const |
Read data from this stream and write it to iStreamW until one or other stream reaches its end. | |
void | CopyTo (const ZStreamW &iStreamW, uint64 iCount) const |
Read data from this stream and write it to iStreamW. | |
void | CopyTo (const ZStreamW &iStreamW, uint64 iCount, uint64 *oCountRead, uint64 *oCountWritten) const |
Read data from this stream and write it to iStreamW. | |
Skip | |
Skip over bytes from this stream without returning them to the caller. | |
void | Skip (uint64 iCount) const |
Skip over iCount bytes. | |
void | Skip (uint64 iCount, uint64 *oCountSkipped) const |
void | SkipAll () const |
void | SkipAll (uint64 *oCountSkipped) const |
Skip bytes until the end of the stream is reached, return the count actually skipped. | |
Read formatted data | |
Read data from the stream in standard formats. | |
int8 | ReadInt8 () const |
int16 | ReadInt16 () const |
int32 | ReadInt32 () const |
int64 | ReadInt64 () const |
float | ReadFloat () const |
double | ReadDouble () const |
int16 | ReadInt16LE () const |
int32 | ReadInt32LE () const |
int64 | ReadInt64LE () const |
float | ReadFloatLE () const |
double | ReadDoubleLE () const |
bool | ReadBool () const |
uint8 | ReadUInt8 () const |
uint16 | ReadUInt16 () const |
uint32 | ReadUInt32 () const |
uint64 | ReadUInt64 () const |
uint16 | ReadUInt16LE () const |
uint32 | ReadUInt32LE () const |
uint64 | ReadUInt64LE () const |
Useful variants | |
Read single bytes without exceptions being thrown. | |
bool | ReadByte (uint8 &oResult) const |
bool | ReadChar (char &oResult) const |
Read standard string | |
std::string | ReadString (size_t iSize) const |
Informational | |
size_t | CountReadable () const |
Essential overrides | |
virtual void | Imp_Read (void *iDest, size_t iCount, size_t *oCountRead)=0 |
Optionally overridable API | |
Default implementations that directly or indirectly call ZStreamR::Imp_Read are provided, but particular subclasses may have more efficient implementations available. | |
virtual size_t | Imp_CountReadable () |
Returns the number of bytes guaranteed to be readable without blocking. | |
virtual void | Imp_CopyToDispatch (const ZStreamW &iStreamW, uint64 iCount, uint64 *oCountRead, uint64 *oCountWritten) |
Invoke iStreamW's Imp_CopyFrom method. | |
virtual void | Imp_CopyTo (const ZStreamW &iStreamW, uint64 iCount, uint64 *oCountRead, uint64 *oCountWritten) |
Actually copy data from this stream to iStreamW. | |
virtual void | Imp_Skip (uint64 iCount, uint64 *oCountSkipped) |
Read and discard iCount bytes. | |
Protected Member Functions | |
Canonical Methods | |
The canonical methods are protected, thus you cannot create, destroy or assign through a ZStreamR reference, you must work with some derived class. | |
ZStreamR () | |
~ZStreamR () | |
ZStreamR (const ZStreamR &) | |
ZStreamR & | operator= (const ZStreamR &) |
void ZStreamR::Read | ( | void * | iDest, | |
size_t | iCount | |||
) | const |
Read iCount bytes into memory starting at iDest.
iDest | The address in memory at which read data is to be placed. It is the caller's responsibilty to ensure that iDest to iDest + iCount is correctly allocated and writeable. | |
iCount | The number of bytes to read |
void ZStreamR::Read | ( | void * | iDest, | |
size_t | iCount, | |||
size_t * | oCountRead | |||
) | const [inline] |
Read data into memory, returning the count actually read.
void ZStreamR::CopyAllTo | ( | const ZStreamW & | iStreamW, | |
uint64 * | oCountRead, | |||
uint64 * | oCountWritten | |||
) | const |
Read data from this stream and write it to iStreamW until one or other stream reaches its end.
iStreamW | The stream to which the data should be written. | |
oCountRead | (optional output) The number of bytes that were actually read. | |
oCountWritten | (optional output) The number of bytes that were actually written. |
CopyTo
or the iStreamW's Write
will likely return zero in oCountWritten.
Read data from this stream and write it to iStreamW.
iStreamW | The stream to which the data should be written. | |
iCount | The number of bytes to be read from this stream and written to iStreamW. |
void ZStreamR::CopyTo | ( | const ZStreamW & | iStreamW, | |
uint64 | iCount, | |||
uint64 * | oCountRead, | |||
uint64 * | oCountWritten | |||
) | const |
Read data from this stream and write it to iStreamW.
iStreamW | The stream to which the data should be written. | |
iCount | The number of bytes to be read from this stream and written to iStreamW. | |
oCountRead | (optional output) The number of bytes that were actually read. | |
oCountWritten | (optional output) The number of bytes that were actually written. |
void ZStreamR::Skip | ( | uint64 | iCount | ) | const |
Skip over iCount bytes.
iCount | The number of bytes to be skipped over. If the stream reaches its end prematurely then an end of read stream exception is thrown. |
Attempt to skip bytes, returning the count actually skipped.
void ZStreamR::SkipAll | ( | ) | const [inline] |
Skip bytes until the end of the stream is reached.
void ZStreamR::SkipAll | ( | uint64 * | oCountSkipped | ) | const |
Skip bytes until the end of the stream is reached, return the count actually skipped.
oCountSkipped | (optional output) The number of bytes actually skipped. If zero is returned then the end of the stream had already been reached. |
int8 ZStreamR::ReadInt8 | ( | ) | const |
Read a single byte from the stream. May throw an end of read stream exception.
int16 ZStreamR::ReadInt16 | ( | ) | const |
Read a big endian 16 bit integer from the stream. May throw an end of read stream exception.
int32 ZStreamR::ReadInt32 | ( | ) | const |
Read a big endian 32 bit integer from the stream. May throw an end of read stream exception.
int64 ZStreamR::ReadInt64 | ( | ) | const |
Read a big endian 64 bit integer from the stream. May throw an end of read stream exception.
float ZStreamR::ReadFloat | ( | ) | const |
Read a big endian IEEE754 single precision float from the stream. May throw an end of read stream exception.
double ZStreamR::ReadDouble | ( | ) | const |
Read a big endian IEEE754 double precision float from the stream. May throw an end of read stream exception.
int16 ZStreamR::ReadInt16LE | ( | ) | const |
Read a little endian 16 bit integer from the stream. May throw an end of read stream exception.
int32 ZStreamR::ReadInt32LE | ( | ) | const |
Read a little endian 32 bit integer from the stream. May throw an end of read stream exception.
int64 ZStreamR::ReadInt64LE | ( | ) | const |
Read a little endian 64 bit integer from the stream. May throw an end of read stream exception.
float ZStreamR::ReadFloatLE | ( | ) | const |
Read a little endian IEEE754 single precision float from the stream. May throw an end of read stream exception.
double ZStreamR::ReadDoubleLE | ( | ) | const |
Read a little endian IEEE754 double precision float from the stream. May throw an end of read stream exception.
bool ZStreamR::ReadBool | ( | ) | const |
Read a single byte from the stream, returning true if it is non-zero. May throw an end of read stream exception.
bool ZStreamR::ReadByte | ( | uint8 & | oResult | ) | const |
Read a single byte from the stream into oResult. If the stream reached its end return false, otherwise return true.
bool ZStreamR::ReadChar | ( | char & | oResult | ) | const |
Read a single byte from the stream into oResult. If the stream reached its end return false, otherwise return true.
string ZStreamR::ReadString | ( | size_t | iSize | ) | const |
Read iSize bytes from the stream and return them in a string. May throw an end of read stream exception.
size_t ZStreamR::CountReadable | ( | ) | const [inline] |
Return the number of bytes guaranteed to be readable without blocking.
size_t ZStreamR::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 in ZStreamRPos, ZStreamR_Buffered, ZStreamR_DynamicBuffered, ZStreamR_Count, ZStreamR_JNI, ZStreamR_Limited, ZStreamR_LZWEncodeNoPatent, ZStreamR_LZWDecode, ZStreamR_MD5, ZStreamRPos_Memory, ZStreamRPos_PageBuffered, ZStreamR_SHA1, ZStreamR_Tee, ZStreamR_Boundary, ZStreamR_Cat, ZStreamR_SkipAllOnDestroy, ZStreamRPos_StreamR, ZStreamRW_FIFO, ZStreamRW_FlushOnRead, ZStreamRW_MemoryPipe, and ZStreamRWPos_RAM.
void ZStreamR::Imp_CopyToDispatch | ( | const ZStreamW & | iStreamW, | |
uint64 | iCount, | |||
uint64 * | oCountRead, | |||
uint64 * | oCountWritten | |||
) | [virtual] |
Invoke iStreamW's Imp_CopyFrom
method.
The first part of the two-stage dispatch initiated by ZStreamR::CopyTo and ZStreamR::CopyAllTo. Override this method if your stream's data is in memory and thus can be written to iStreamW by a single call to its Write
method.
Reimplemented in ZStreamR_Null, ZStreamRPos_Null, ZStreamR_Count, ZStreamR_Limited, ZStreamR_Memory, ZStreamRPos_Memory, ZStreamR_SkipAllOnDestroy, ZStreamR_Source, ZStreamRW_FlushOnRead, and ZStreamRW_MemoryPipe.
void ZStreamR::Imp_CopyTo | ( | const ZStreamW & | iStreamW, | |
uint64 | iCount, | |||
uint64 * | oCountRead, | |||
uint64 * | oCountWritten | |||
) | [virtual] |
Actually copy data from this stream to iStreamW.
The second part of the two-stage dispatch initiated by ZStreamW::CopyFrom and ZStreamW::CopyAllFrom. The default implementation calls sCopyReadToWrite
. Override this method if your stream's data is in memory and thus can be written to iStreamW by a single call to its Write
method.
Reimplemented in ZStreamR_Null, ZStreamRPos_Null, ZStreamR_Count, ZStreamR_Limited, ZStreamR_Memory, ZStreamRPos_Memory, ZStreamR_SkipAllOnDestroy, ZStreamR_Source, ZStreamRW_FlushOnRead, and ZStreamRW_MemoryPipe.
Read and discard iCount bytes.
Override this method if your stream implementation can skip past bytes in the stream without actually reading them.
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 in ZStreamRPos, ZStreamR_Null, ZStreamRPos_Null, ZStreamR_Buffered, ZStreamR_Count, ZStreamR_Limited, ZStreamR_Memory, ZStreamRPos_Memory, ZStreamRPos_PageBuffered, ZStreamR_Cat, ZStreamR_SkipAllOnDestroy, ZStreamR_Source, ZStreamRW_FlushOnRead, ZStreamRW_MemoryPipe, and ZStreamRWPos_RAM.