StreamWriter Class Reference

#include <streamwriter.h>

Inheritance diagram for StreamWriter:
FileStreamWriter

List of all members.

Public Member Functions

 StreamWriter (Object *dictA)
virtual void putChar (int ch)=0
virtual void putLine (const char *line, size_t length)=0
virtual bool trim (size_t pos)=0
virtual void flush () const =0
virtual size_t cloneToFile (FILE *file, size_t start, size_t length)=0

Detailed Description

Abstract class for all BaseStream writers.

Declares base interface for all writers to Base stream. All real writers should implement this abstract class and stream type which is written.


Constructor & Destructor Documentation

StreamWriter::StreamWriter ( Object *  dictA  )  [inline]

Constructor with dictionary object.

Parameters:
dictA Object where to store stream dictionary.

Member Function Documentation

virtual size_t StreamWriter::cloneToFile ( FILE *  file,
size_t  start,
size_t  length 
) [pure virtual]

Duplicates content to given file.

Parameters:
file File where to put duplicated content.
start Position where to start duplication.
length Number of bytes to be duplicated.

Copies up to length bytes from start postion from stream to given file.

Returns:
number of bytes writen to given file.

Implemented in FileStreamWriter.

Referenced by pdfobjects::XRefWriter::cloneRevision().

virtual void StreamWriter::flush (  )  const [pure virtual]

Forces stream flush.

Cached data in stream are forced to be writen to the target.

Implemented in FileStreamWriter.

virtual void StreamWriter::putChar ( int  ch  )  [pure virtual]

Puts character at current position.

Parameters:
ch Character to put to the stream.

If current position is not at the end of file, overwrites previous content and moves position. Otherwise appends stream.

Implemented in FileStreamWriter.

virtual void StreamWriter::putLine ( const char *  line,
size_t  length 
) [pure virtual]

Puts exactly length number of byte to one line.

Parameters:
line Line buffer pointer.
length Number of bytes to be printed.

Doesn't check end of the string '' and prints exactly given number of bytes. This should be used when binary data are stored in line and so they may contain '' bytes.
Caller should guarantee that line is allocated at least for length size. Otherwise result is unpredictable.

Implemented in FileStreamWriter.

Referenced by pdfobjects::utils::ZlibFilterStreamWriter::compress(), pdfobjects::utils::NullFilterStreamWriter::compress(), pdfobjects::utils::IPdfWriter::writeHeader(), pdfobjects::utils::writeObject(), and pdfobjects::utils::OldStylePdfWriter::writeTrailer().

virtual bool StreamWriter::trim ( size_t  pos  )  [pure virtual]

Removes all data behind given position.

Parameters:
pos Stream offset from where to trim.

Removes all bytes behind (inclusive) given position from the stream.

Returns:
true if stream was trimed, false otherwise.

Implemented in FileStreamWriter.

Referenced by pdfobjects::utils::OldStylePdfWriter::writeTrailer().


The documentation for this class was generated from the following file: