#include <cel_stream.h>
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 () |
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.
|
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.
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. |
|
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.
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. |
|
pure virtual |
flushBuffer is provided for the purpose of flushing buffered stream.
Implemented in Celartem::PartialStream, Celartem::ByteCounterStream, and Celartem::NullStream.
|
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.
true
if the file pointer reachs EOF, otherwise false
. Implemented in Celartem::PartialStream, Celartem::ByteCounterStream, and Celartem::NullStream.
|
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.
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. |
Implemented in Celartem::PartialStream, Celartem::ByteCounterStream, and Celartem::NullStream.
Referenced by Celartem::DjVu::MemoryData::create().
|
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.
buffer | Pointer to the buffer that holds the data to be sent. |
inSize | the number of bytes to be sent. |
Implemented in Celartem::PartialStream, Celartem::ByteCounterStream, and Celartem::NullStream.