Celartem::PartialStream Class Reference

#include <cel_stream.h>

Inheritance diagram for Celartem::PartialStream:

Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual size_t readBytes (void *buffer, size_t inSize, bool wouldBlock=false)
virtual void writeBytes (const void *buffer, size_t inSize)
virtual void flushBuffer ()
virtual bool isEof () const
virtual void lock () const
virtual void unlock () const

Static Public Member Functions

static AutoPtr< PartialStreamcreate (Stream *inStream, uint64_t inSize)


Detailed Description

This stream class limits read/write operations to the specified size.

Definition at line 512 of file cel_stream.h.


Member Function Documentation

static AutoPtr<PartialStream> Celartem::PartialStream::create ( Stream inStream,
uint64_t  inSize 
) [inline, static]

This method creates an instance of PartialStream class.

Parameters:
inStream Base stream. The actual operation will be done on the stream.
inSize The maximum size to read/write.

Definition at line 522 of file cel_stream.h.

virtual size_t Celartem::PartialStream::readBytes ( void *  buffer,
size_t  inSize,
bool  wouldBlock = false 
) [inline, 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.

Implements Celartem::Stream.

Definition at line 527 of file cel_stream.h.

virtual void Celartem::PartialStream::writeBytes ( const void *  buffer,
size_t  inSize 
) [inline, 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.

Implements Celartem::Stream.

Definition at line 542 of file cel_stream.h.

virtual void Celartem::PartialStream::flushBuffer (  )  [inline, virtual]

flushBuffer is provided for the purpose of flushing buffered stream.

Implements Celartem::Stream.

Definition at line 550 of file cel_stream.h.

virtual bool Celartem::PartialStream::isEof (  )  const [inline, 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.

Implements Celartem::Stream.

Definition at line 555 of file cel_stream.h.

virtual void Celartem::PartialStream::lock (  )  const [inline, virtual]

The actual meanings of this method is defined in the derived class.

Implements Celartem::Lockable.

Definition at line 562 of file cel_stream.h.

virtual void Celartem::PartialStream::unlock (  )  const [inline, virtual]

The actual meanings of this method is defined in the derived class.

Implements Celartem::Lockable.

Definition at line 564 of file cel_stream.h.


The documentation for this class was generated from the following file:
This document is automatically generated using doxygen 1.5.4 at Fri Jun 27 18:23:23 2008.