Public Member Functions

Celartem::Stream Class Reference

#include <cel_stream.h>

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

List of all members.

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)

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:
inStream This parameter specifies the source stream to copy data from.
inBufferSize Internal buffer size used to copy stream data.
inCallback A callback called when an internal read call finishes.
inCallbackContext A 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:
inStream This parameter specifies the source stream to copy data from.
inMaximumByteSize The maximum bytes to copy. If 0 is specified, no restriction on the number of bytes to copy.
inBufferSize Internal buffer size used to copy stream data.
inCallback A callback called when an internal read call finishes.
inCallbackContext A 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::NullStream, Celartem::ByteCounterStream, and Celartem::PartialStream.

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::NullStream, Celartem::ByteCounterStream, and Celartem::PartialStream.

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:
buffer Pointer to a buffer that receives the data.
inSize Maximum size to read; readBytes reads data no more than the number of bytes specified by inSize.
wouldBlock It specifies it blocks until all bytes comes or not.
Returns:
readBytes returns the number of bytes read by this call.

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

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:
buffer Pointer to the buffer that holds the data to be sent.
inSize the number of bytes to be sent.

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


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

This document is made with doxygen 1.7.1 at Thu Feb 17 2011 15:40:19.
Caminova Logo