DWFCore::DWFBufferInputStream Class Reference

#include "dwfcore/BufferInputStream.h"

Inheritance diagram for DWFCore::DWFBufferInputStream:

Inheritance graph
[legend]
Collaboration diagram for DWFCore::DWFBufferInputStream:

Collaboration graph
[legend]
List of all members.

Detailed Description

An input stream object that uses either a memory buffer or another input stream as it's data source.

Since:
1.0.1
This implementation of the DWFInputStream can be used to provide streaming read access to a memory buffer. This class can also be used to link [chain] another input stream or streams to a single interface.

Definition at line 48 of file BufferInputStream.h.

Public Member Functions

_DWFCORE_API DWFBufferInputStream (const void *pBuffer, size_t nBufferBytes, bool bOwnBuffer=false) throw ()
_DWFCORE_API DWFBufferInputStream (DWFInputStream *pInputStream, bool bOwnStream) throw ()
virtual _DWFCORE_API ~DWFBufferInputStream () throw ()
virtual _DWFCORE_API size_t available () const throw ( DWFException )
virtual _DWFCORE_API size_t read (void *pBuffer, size_t nBytesToRead) throw ( DWFException )
virtual _DWFCORE_API off_t seek (int eOrigin, off_t nOffset) throw ( DWFException )
_DWFCORE_API void chainInputStream (DWFInputStream *pInputStream, bool bOwnStream) throw ()

Protected Attributes

const void * _pBuffer
size_t _iBufferPos
size_t _nBufferBytes
size_t _nAvailableBytes


Constructor & Destructor Documentation

_DWFCORE_API DWFCore::DWFBufferInputStream::DWFBufferInputStream const void *  pBuffer,
size_t  nBufferBytes,
bool  bOwnBuffer = false
throw ()
 

Constructor

Use this constructor to configure with a memory buffer source.

Parameters:
pBuffer A memory block from which to stream data.
nBufferBytes The number of bytes in the memory block pBuffer.
bOwnBuffer If true, this object will assume ownership of pBuffer and delete it as necessary using DWFCORE_FREE_MEMORY. If false (default), the caller retains ownership of pBuffer and is responsible for deleting it.
Exceptions:
None 

_DWFCORE_API DWFCore::DWFBufferInputStream::DWFBufferInputStream DWFInputStream pInputStream,
bool  bOwnStream
throw ()
 

Constructor

Use this constructor to configure with another stream source.

Parameters:
pInputStream An input stream from which to stream data. This object should be allocated with the DWFCORE_ALLOC_OBJECT macro if ownership will be transferred.
bOwnStream If true, this object will assume ownership of pInputStream and delete it as necessary using DWFCORE_FREE_OBJECT. If false, the caller retains ownership of pInputStream and is responsible for deleting it.
Exceptions:
None 

virtual _DWFCORE_API DWFCore::DWFBufferInputStream::~DWFBufferInputStream  )  throw () [virtual]
 

Destructor

Exceptions:
None 


Member Function Documentation

virtual _DWFCORE_API size_t DWFCore::DWFBufferInputStream::available  )  const throw ( DWFException ) [virtual]
 

Used to determine the availablity of data that may be provided from the underlying memory buffer or input stream.

Returns:
The number of bytes available to read from the stream.
Exceptions:
DWFException 

Implements DWFCore::DWFInputStream.

_DWFCORE_API void DWFCore::DWFBufferInputStream::chainInputStream DWFInputStream pInputStream,
bool  bOwnStream
throw ()
 

Attaches (or detaches) another input stream to object. Chaining simply refers to the process of using one stream as the source for another. Any number of these objects can be chained together to add functionality and data modification a single read() invocation.

Parameters:
pInputStream A pointer to a stream to chain to this object. If this pointer is NULL and another stream was previously chained to this object, it will be cleared (and deleted if owned.) This object should be allocated with the DWFCORE_ALLOC_OBJECT macro. if ownership will be transferred.
bOwnStream If true, this object will assume ownership of pInputStream and delete it as necessary using DWFCORE_FREE_OBJECT. If false, the caller retains ownership of pInputStream and is responsible for deleting it.

virtual _DWFCORE_API size_t DWFCore::DWFBufferInputStream::read void *  pBuffer,
size_t  nBytesToRead
throw ( DWFException ) [virtual]
 

Reads at most nBytesToRead from the underlying memory buffer or input stream into the buffer provided. The stream is not required to fill the read buffer but it must always report the number of bytes, including zero, that were obtained.

Parameters:
pBuffer A pointer to a block of memory to receive the bytes. Any implementation receiving a NULL buffer pointer should throw a DWFInvalidArgumentException.
nBytesToRead The number of bytes to copy into pBuffer. This value should not exceed the capacity of the memory block at pBuffer.
Returns:
The number of actual bytes read.
Exceptions:
DWFException 

Implements DWFCore::DWFInputStream.

virtual _DWFCORE_API off_t DWFCore::DWFBufferInputStream::seek int  eOrigin,
off_t  nOffset
throw ( DWFException ) [virtual]
 

Repositions the internal cursor for subsequent read invocations. This method may fail and throw an exception if the request either exceeds the bounds of the underlying memory buffer, or exhausts the underlying stream or the underlying stream does not support the method itself.

Parameters:
eOrigin One of SEEK_SET, SEEK_CUR or SEEK_END.
nOffset The number of bytes from eOrigin to move the internal cursor.
Returns:
The previous cursor offset before the seek.
Exceptions:
DWFException 

Implements DWFCore::DWFInputStream.


The documentation for this class was generated from the following file:
Generated on Tue Jan 6 22:39:32 2009 for Autodesk DWF Core Library by  doxygen 1.4.5