PoDoFo::PdfMemStream Class Reference

#include <PdfMemStream.h>

Inheritance diagram for PoDoFo::PdfMemStream:

PoDoFo::PdfStream

List of all members.

Public Member Functions

 PdfMemStream (PdfObject *pParent)
 PdfMemStream (const PdfMemStream &rhs)
virtual void Write (PdfOutputDevice *pDevice, PdfEncrypt *pEncrypt=NULL)
virtual void GetCopy (char **pBuffer, long *lLen) const
const char * Get () const
unsigned long GetLength () const
void FlateCompress ()
void Uncompress ()
void Empty ()
const PdfStreamoperator= (const PdfStream &rhs)

Protected Member Functions

virtual const char * GetInternalBuffer () const
virtual unsigned long GetInternalBufferSize () const
virtual void BeginAppendImpl (const TVecFilters &vecFilters)
virtual void AppendImpl (const char *pszString, size_t lLen)
virtual void EndAppendImpl ()


Detailed Description

A PDF stream can be appended to any PdfObject and can contain abitrary data.

A PDF memory stream is held completely in memory.

Most of the time it will contain either drawing commands to draw onto a page or binary data like a font or an image.

A PdfMemStream is implicitly shared and can therefore be copied very quickly.


Constructor & Destructor Documentation

PoDoFo::PdfMemStream::PdfMemStream ( PdfObject pParent  ) 

Create a new PdfStream object which has a parent PdfObject. The stream will be deleted along with the parent. This constructor will be called by PdfObject::Stream() for you.

Parameters:
pParent parent object

PoDoFo::PdfMemStream::PdfMemStream ( const PdfMemStream rhs  ) 

Create a shallow copy of a PdfStream object

Parameters:
rhs the object to clone


Member Function Documentation

void PoDoFo::PdfMemStream::AppendImpl ( const char *  pszString,
size_t  lLen 
) [protected, virtual]

Append a binary buffer to the current stream contents.

Parameters:
pszString a buffer
lLen length of the buffer
See also:
BeginAppend

Append

EndAppend

Implements PoDoFo::PdfStream.

void PoDoFo::PdfMemStream::BeginAppendImpl ( const TVecFilters &  vecFilters  )  [protected, virtual]

Begin appending data to this stream. Clears the current stream contents.

Parameters:
vecFilters use this filters to encode any data written to the stream.

Implements PoDoFo::PdfStream.

void PoDoFo::PdfMemStream::Empty (  ) 

Empty's the stream and set the streams buffer size to 0

void PoDoFo::PdfMemStream::EndAppendImpl (  )  [protected, virtual]

Finish appending data to the stream

Implements PoDoFo::PdfStream.

void PoDoFo::PdfMemStream::FlateCompress (  ) 

This function compresses any currently set stream using the FlateDecode(ZIP) algorithm. JPEG compressed streams will not be compressed again using this function. Entries to the filter dictionary will be added if necessary.

const char * PoDoFo::PdfMemStream::Get (  )  const [inline]

Get a read-only handle to the current stream data. The data will not be filtered before being returned, so (eg) calling Get() on a Flate compressed stream will return a pointer to the Flate-compressed buffer.

Warning:
Do not retain pointers to the stream's internal buffer, as it may be reallocated with any non-const operation.
Returns:
a read-only handle to the streams data

void PoDoFo::PdfMemStream::GetCopy ( char **  pBuffer,
long *  lLen 
) const [virtual]

Get a malloced buffer of the current stream. No filters will be applied to the buffer, so if the stream is Flate compressed the compressed copy will be returned.

The caller has to free() the buffer.

Parameters:
pBuffer pointer to the buffer
lLen pointer to the buffer length
Returns:
ErrOk on success.

Implements PoDoFo::PdfStream.

const char * PoDoFo::PdfMemStream::GetInternalBuffer (  )  const [inline, protected, virtual]

Required for the GetFilteredCopy implementation

Returns:
a handle to the internal buffer

Implements PoDoFo::PdfStream.

unsigned long PoDoFo::PdfMemStream::GetInternalBufferSize (  )  const [inline, protected, virtual]

Required for the GetFilteredCopy implementation

Returns:
the size of the internal buffer

Implements PoDoFo::PdfStream.

unsigned long PoDoFo::PdfMemStream::GetLength (  )  const [inline, virtual]

Get the stream's length. The length is that of the internal stream buffer, so (eg) for a Flate-compressed stream it will be the length of the compressed data.

Returns:
the length of the internal buffer
See also:
Get()

Implements PoDoFo::PdfStream.

const PdfStream & PoDoFo::PdfMemStream::operator= ( const PdfStream rhs  ) 

Create a copy of a PdfStream object

Parameters:
rhs the object to clone
Returns:
a reference to this object

Reimplemented from PoDoFo::PdfStream.

void PoDoFo::PdfMemStream::Uncompress (  ) 

This method removes all filters from the stream

void PoDoFo::PdfMemStream::Write ( PdfOutputDevice pDevice,
PdfEncrypt pEncrypt = NULL 
) [virtual]

Write the stream to an output device

Parameters:
pDevice write to this outputdevice.
pEncrypt encrypt stream data using this object

Implements PoDoFo::PdfStream.


Generated on Tue Jul 28 00:01:34 2009 for PoDoFo by  doxygen 1.5.9