PoDoFo 0.9.6
Public Member Functions | List of all members
PoDoFo::PdfMemoryOutputStream Class Reference

#include <PdfOutputStream.h>

Inheritance diagram for PoDoFo::PdfMemoryOutputStream:
PoDoFo::PdfOutputStream

Public Member Functions

 PdfMemoryOutputStream (pdf_long lInitial=INITIAL_SIZE)
 
 PdfMemoryOutputStream (char *pBuffer, pdf_long lLen)
 
virtual pdf_long Write (const char *pBuffer, pdf_long lLen)
 
virtual void Close ()
 
pdf_long GetLength () const
 
const char * GetBuffer () const
 
char * TakeBuffer ()
 
- Public Member Functions inherited from PoDoFo::PdfOutputStream
virtual pdf_long Write (const char *pBuffer, pdf_long lLen)=0
 
pdf_long Write (const std::string &s)
 
virtual void Close ()=0
 

Detailed Description

An output stream that writes data to a memory buffer If the buffer is to small, it will be enlarged automatically.

DS: TODO: remove in favour of PdfBufferOutputStream.

Constructor & Destructor Documentation

◆ PdfMemoryOutputStream() [1/2]

PoDoFo::PdfMemoryOutputStream::PdfMemoryOutputStream ( pdf_long  lInitial = INITIAL_SIZE)

Construct a new PdfMemoryOutputStream

Parameters
lInitialinitial size of the buffer

◆ PdfMemoryOutputStream() [2/2]

PoDoFo::PdfMemoryOutputStream::PdfMemoryOutputStream ( char *  pBuffer,
pdf_long  lLen 
)

Construct a new PdfMemoryOutputStream that writes to an existing buffer

Parameters
pBufferhandle to the buffer
lLenlength of the buffer

Member Function Documentation

◆ Close()

virtual void PoDoFo::PdfMemoryOutputStream::Close ( )
inlinevirtual

Close the PdfOutputStream. This method may throw exceptions and has to be called before the destructor to end writing.

No more data may be written to the output device after calling close.

Implements PoDoFo::PdfOutputStream.

◆ GetBuffer()

const char * PoDoFo::PdfMemoryOutputStream::GetBuffer ( ) const
inline
Returns
a const handle to the internal buffer.

The returned buffer is still owned by the PdfMemoryOutputStream.

◆ GetLength()

pdf_long PoDoFo::PdfMemoryOutputStream::GetLength ( ) const
inline
Returns
the length of the written data

◆ TakeBuffer()

char * PoDoFo::PdfMemoryOutputStream::TakeBuffer ( )
inline
Returns
a handle to the internal buffer.

The internal buffer is now owned by the caller and will not be deleted by PdfMemoryOutputStream. Further calls to Write() are not allowed.

The caller has to free() the returned malloc()'ed buffer!

◆ Write()

pdf_long PoDoFo::PdfMemoryOutputStream::Write ( const char *  pBuffer,
pdf_long  lLen 
)
virtual

Write data to the output stream

Parameters
pBufferthe data is read from this buffer
lLenthe size of the buffer
Returns
the number of bytes written, -1 if an error occurred

Implements PoDoFo::PdfOutputStream.