Public Member Functions | List of all members
Celartem::Stream Class Referenceabstract

#include <cel_stream.h>

Inheritance diagram for Celartem::Stream:
Inheritance graph
[legend]

Public Member Functions

virtual size_t readBytes (void *buffer, size_t inSize, bool wouldBlock=false)=0
 
virtual void writeBytes (const void *buffer, size_t inSize)=0
 
virtual void flushBuffer ()=0
 
virtual bool isEof () const =0
 
virtual size_t duplicateStream (Stream *inStream, size_t inBufferSize=1024, DuplicateStreamCallback inCallback=NULL, void *inCallbackContext=NULL)
 
virtual size_t duplicateStreamBytes (Stream *inStream, size_t inMaximumByteSize, size_t inBufferSize=1024, DuplicateStreamCallback inCallback=NULL, void *inCallbackContext=NULL)
 
- Public Member Functions inherited from Celartem::Referable
 Referable ()
 
void addRef () const
 
void releaseRef () const
 
size_t getReferenceCount () const
 
- Public Member Functions inherited from Celartem::Lockable
virtual void lock () const =0
 
virtual void unlock () const =0
 

Additional Inherited Members

- Static Public Member Functions inherited from Celartem::Referable
static void dumpDbgAllRefCount ()
 

Detailed Description

Stream class is abstract class that defines base functions of stream; it does not have any size/position property because they are supported by Storage class, which inherits Stream class.

Member Function Documentation

virtual size_t Celartem::Stream::duplicateStream ( Stream inStream,
size_t  inBufferSize = 1024,
DuplicateStreamCallback  inCallback = NULL,
void *  inCallbackContext = NULL 
)
virtual

This function does duplicate the contents of inStream until it's EOF. Some derivative classes can change the behavior of this method if there're some security considerations or something like them.

Parameters
inStreamThis parameter specifies the source stream to copy data from.
inBufferSizeInternal buffer size used to copy stream data.
inCallbackA callback called when an internal read call finishes.
inCallbackContextA context for the callback.
Returns
The bytes actually copied from the source stream.
virtual size_t Celartem::Stream::duplicateStreamBytes ( Stream inStream,
size_t  inMaximumByteSize,
size_t  inBufferSize = 1024,
DuplicateStreamCallback  inCallback = NULL,
void *  inCallbackContext = NULL 
)
virtual

This function does duplicate the contents of inStream untill it reads all bytes specified by inMaximumByteSize or comes to it's EOF. Some derivative classes can change the behavior of this method if there're some security considerations or something like them.

Parameters
inStreamThis parameter specifies the source stream to copy data from.
inMaximumByteSizeThe maximum bytes to copy. If 0 is specified, no restriction on the number of bytes to copy.
inBufferSizeInternal buffer size used to copy stream data.
inCallbackA callback called when an internal read call finishes.
inCallbackContextA context for the callback.
Returns
The bytes actually copied from the source stream.
virtual void Celartem::Stream::flushBuffer ( )
pure virtual

flushBuffer is provided for the purpose of flushing buffered stream.

Implemented in Celartem::PartialStream, Celartem::ByteCounterStream, and Celartem::NullStream.

virtual bool Celartem::Stream::isEof ( ) const
pure virtual

isEof return true if the stream pointer has already reached the end of stream; you should not rely on readBytes to determine the end of stream.

Returns
true if the file pointer reachs EOF, otherwise false.

Implemented in Celartem::PartialStream, Celartem::ByteCounterStream, and Celartem::NullStream.

virtual size_t Celartem::Stream::readBytes ( void *  buffer,
size_t  inSize,
bool  wouldBlock = false 
)
pure virtual

readBytes tries to read bytes from the stream. If wouldBlock is false, readBytes reads the data currenly available and returned immediately; the returned value indicates the bytes actually read and it is no more than inSize. If wouldBlock is true, it blocks until it reads all the bytes specified by inSize parameter. If the stream is potentially read-only and it seems there're no chance to read the bytes specified by inSize, it throws some exception. In the case it throws some exception, the contents in the buffer is invalid and the position of stream pointer is not defined; they are implementation specific.

Parameters
bufferPointer to a buffer that receives the data.
inSizeMaximum size to read; readBytes reads data no more than the number of bytes specified by inSize.
wouldBlockIt specifies it blocks until all bytes comes or not.
Returns
readBytes returns the number of bytes read by this call.

Implemented in Celartem::PartialStream, Celartem::ByteCounterStream, and Celartem::NullStream.

Referenced by Celartem::DjVu::MemoryData::create().

virtual void Celartem::Stream::writeBytes ( const void *  buffer,
size_t  inSize 
)
pure virtual

writeBytes tries to write the data to the stream. If it could not write all the bytes specified by inSize, it throws some exception, which describes the status. In the case it throws some exception, the position of stream pointer is not defined; it is implementation specific.

Parameters
bufferPointer to the buffer that holds the data to be sent.
inSizethe number of bytes to be sent.

Implemented in Celartem::PartialStream, Celartem::ByteCounterStream, and Celartem::NullStream.


The documentation for this class was generated from the following file:

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:06.
Cuminas Logo