/usr/include/podofo/base/PdfFileStream.h is in libpodofo-dev 0.9.0-1.2+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | /***************************************************************************
* Copyright (C) 2007 by Dominik Seichter *
* domseichter@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _PDF_FILE_STREAM_H_
#define _PDF_FILE_STREAM_H_
#include "PdfDefines.h"
#include "PdfStream.h"
namespace PoDoFo {
class PdfOutputStream;
/** A PDF stream can be appended to any PdfObject
* and can contain arbitrary data.
*
* 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 PdfFileStream writes all data directly to an output device
* without keeping it in memory.
* PdfFileStream is used automatically when creating PDF files
* using PdfImmediateWriter.
*
* \see PdfVecObjects
* \see PdfStream
* \see PdfMemoryStream
* \see PdfFileStream
*/
class PODOFO_API PdfFileStream : public PdfStream {
public:
/** Create a new PdfFileStream 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.
*
* \param pParent parent object
* \param pDevice output device
*/
PdfFileStream( PdfObject* pParent, PdfOutputDevice* pDevice );
virtual ~PdfFileStream();
/** Set an encryption object which is used to encrypt
* all data written to this stream.
*
* \param pEncrypt an encryption object or NULL if no encryption should be done
*/
void SetEncrypted( PdfEncrypt* pEncrypt );
/** Write the stream to an output device
* \param pDevice write to this outputdevice.
* \param pEncrypt encrypt stream data using this object
*/
virtual void Write( PdfOutputDevice* pDevice, PdfEncrypt* pEncrypt = NULL );
/** 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.
*
* This is currently not implemented for PdfFileStreams
* and will raise an ePdfError_InternalLogic exception
*
* \param pBuffer pointer to the buffer
* \param lLen pointer to the buffer length
* \returns ErrOk on success.
*/
virtual void GetCopy( char** pBuffer, pdf_long* lLen ) const;
/** Get a copy of a the stream and write it to a PdfOutputStream
*
* \param pStream data is written to this stream.
*/
virtual void GetCopy( PdfOutputStream* pStream ) const;
/** Get the streams length with all filters applied (eg the compressed
* length of a Flate compressed stream).
*
* \returns the length of the stream with all filters applied
*/
inline virtual pdf_long GetLength() const;
protected:
/** Required for the GetFilteredCopy implementation
* \returns a handle to the internal buffer
*/
inline virtual const char* GetInternalBuffer() const;
/** Required for the GetFilteredCopy implementation
* \returns the size of the internal buffer
*/
inline virtual pdf_long GetInternalBufferSize() const;
/** Begin appending data to this stream.
* Clears the current stream contents.
*
* \param vecFilters use this filters to encode any data written to the stream.
*/
virtual void BeginAppendImpl( const TVecFilters & vecFilters );
/** Append a binary buffer to the current stream contents.
*
* \param pszString a buffer
* \param lLen length of the buffer
*
* \see BeginAppend
* \see Append
* \see EndAppend
*/
virtual void AppendImpl( const char* pszString, size_t lLen );
/** Finish appending data to the stream
*/
virtual void EndAppendImpl();
private:
PdfOutputDevice* m_pDevice;
PdfOutputStream* m_pStream;
PdfOutputStream* m_pDeviceStream;
PdfOutputStream* m_pEncryptStream;
pdf_long m_lLenInitial;
pdf_long m_lLength;
PdfObject* m_pLength;
PdfEncrypt* m_pCurEncrypt;
};
// -----------------------------------------------------
//
// -----------------------------------------------------
pdf_long PdfFileStream::GetLength() const
{
return m_lLength;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
const char* PdfFileStream::GetInternalBuffer() const
{
return NULL;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
pdf_long PdfFileStream::GetInternalBufferSize() const
{
return 0;
}
};
#endif // _PDF_FILE_STREAM_H_
|