LibreOffice Module oox (master) 1
Public Member Functions | Private Attributes | List of all members
oox::BinaryXOutputStream Class Referencefinal

Wraps a UNO output stream and provides convenient access functions. More...

#include <binaryoutputstream.hxx>

Inheritance diagram for oox::BinaryXOutputStream:
[legend]
Collaboration diagram for oox::BinaryXOutputStream:
[legend]

Public Member Functions

 BinaryXOutputStream (const css::uno::Reference< css::io::XOutputStream > &rxOutStrm, bool bAutoClose)
 Constructs the wrapper object for the passed output stream. More...
 
virtual ~BinaryXOutputStream () override
 
void close () override
 Flushes and closes the output stream. More...
 
virtual void writeData (const StreamDataSequence &rData, size_t nAtomSize=1) override
 Writes the passed data sequence. More...
 
virtual void writeMemory (const void *pMem, sal_Int32 nBytes, size_t nAtomSize=1) override
 Write nBytes bytes from the (preallocated!) buffer pMem. More...
 
- Public Member Functions inherited from oox::BinaryXSeekableStream
virtual ~BinaryXSeekableStream () override
 
virtual sal_Int64 size () const override
 Returns the size of the stream, if wrapped stream is seekable, otherwise -1. More...
 
virtual sal_Int64 tell () const override
 Returns the current stream position, if wrapped stream is seekable, otherwise -1. More...
 
virtual void seek (sal_Int64 nPos) override
 Seeks the stream to the passed position, if wrapped stream is seekable. More...
 
virtual void close () override
 Releases the reference to the UNO XSeekable interface. More...
 
- Public Member Functions inherited from oox::BinaryStreamBase
virtual ~BinaryStreamBase ()
 
virtual sal_Int64 size () const =0
 Implementations return the size of the stream, if possible. More...
 
virtual sal_Int64 tell () const =0
 Implementations return the current stream position, if possible. More...
 
virtual void seek (sal_Int64 nPos)=0
 Implementations seek the stream to the passed position, if the stream is seekable. More...
 
virtual void close ()=0
 Implementations close the stream. More...
 
bool isSeekable () const
 Returns true, if the implementation supports the seek() operation. More...
 
bool isEof () const
 Returns true, if the stream position is invalid (EOF). More...
 
sal_Int64 getRemaining () const
 Returns the size of the remaining data available in the stream, if stream supports size() and tell(), otherwise -1. More...
 
void seekToStart ()
 Seeks the stream to the beginning, if stream is seekable. More...
 
void alignToBlock (sal_Int32 nBlockSize, sal_Int64 nAnchorPos)
 Seeks the stream forward to a position that is a multiple of the passed block size, if stream is seekable. More...
 
- Public Member Functions inherited from oox::BinaryOutputStream
virtual void writeData (const StreamDataSequence &rData, size_t nAtomSize=1)=0
 Derived classes implement writing the contents of the passed data sequence. More...
 
virtual void writeMemory (const void *pMem, sal_Int32 nBytes, size_t nAtomSize=1)=0
 Derived classes implement writing the contents of the (preallocated!) memory buffer pMem. More...
 
template<typename Type >
void writeArray (Type *opnArray, sal_Int32 nElemCount)
 
template<typename Type >
void writeArray (const Type *opnArray, sal_Int32 nElemCount)
 
template<typename Type >
void writeValue (Type nValue)
 Writes a value to the stream and converts it to platform byte order. More...
 
BinaryOutputStreamWriteInt16 (sal_Int16 x)
 
BinaryOutputStreamWriteUInt16 (sal_uInt16 x)
 
BinaryOutputStreamWriteInt32 (sal_Int32 x)
 
BinaryOutputStreamWriteUInt32 (sal_uInt32 x)
 
BinaryOutputStreamWriteInt64 (sal_Int64 x)
 
void writeCompressedUnicodeArray (const OUString &rString, bool bCompressed)
 
void writeCharArrayUC (std::u16string_view rString, rtl_TextEncoding eTextEnc)
 
void writeUnicodeArray (const OUString &rString)
 

Private Attributes

StreamDataSequence maBuffer
 Data buffer used in writeMemory() function. More...
 
css::uno::Reference< css::io::XOutputStream > mxOutStrm
 Reference to the output stream. More...
 
bool mbAutoClose
 True = automatically close stream on destruction. More...
 

Additional Inherited Members

- Protected Member Functions inherited from oox::BinaryXSeekableStream
 BinaryXSeekableStream (const css::uno::Reference< css::io::XSeekable > &rxSeekable)
 
- Protected Member Functions inherited from oox::BinaryStreamBase
 BinaryStreamBase (bool bSeekable)
 
- Protected Member Functions inherited from oox::BinaryOutputStream
 BinaryOutputStream ()
 This dummy default c'tor will never call the c'tor of the virtual base class BinaryStreamBase as this class cannot be instantiated directly. More...
 
- Protected Attributes inherited from oox::BinaryStreamBase
bool mbEof
 End of stream flag. More...
 

Detailed Description

Wraps a UNO output stream and provides convenient access functions.

The binary data in the stream is written in little-endian format.

Definition at line 128 of file binaryoutputstream.hxx.

Constructor & Destructor Documentation

◆ BinaryXOutputStream()

oox::BinaryXOutputStream::BinaryXOutputStream ( const css::uno::Reference< css::io::XOutputStream > &  rxOutStrm,
bool  bAutoClose 
)
explicit

Constructs the wrapper object for the passed output stream.

Parameters
rxOutStreamThe com.sun.star.io.XOutputStream interface of the output stream to be wrapped.
bAutoCloseTrue = automatically close the wrapped output stream on destruction of this wrapper or when close() is called.

Definition at line 38 of file binaryoutputstream.cxx.

References oox::BinaryStreamBase::mbEof, mxOutStrm, and Reference.

◆ ~BinaryXOutputStream()

oox::BinaryXOutputStream::~BinaryXOutputStream ( )
overridevirtual

Definition at line 48 of file binaryoutputstream.cxx.

References close().

Member Function Documentation

◆ close()

void oox::BinaryXOutputStream::close ( )
overridevirtual

Flushes and closes the output stream.

Does also close the wrapped UNO output stream if bAutoClose has been set to true in the constructor.

Reimplemented from oox::BinaryXSeekableStream.

Definition at line 53 of file binaryoutputstream.cxx.

References oox::BinaryXSeekableStream::close(), Exception, mbAutoClose, and mxOutStrm.

Referenced by oox::crypto::DocumentEncryption::encrypt(), and ~BinaryXOutputStream().

◆ writeData()

void oox::BinaryXOutputStream::writeData ( const StreamDataSequence rData,
size_t  nAtomSize = 1 
)
overridevirtual

Writes the passed data sequence.

Implements oox::BinaryOutputStream.

Definition at line 71 of file binaryoutputstream.cxx.

References Exception, and mxOutStrm.

Referenced by oox::crypto::DocumentEncryption::encrypt(), and writeMemory().

◆ writeMemory()

void oox::BinaryXOutputStream::writeMemory ( const void *  pMem,
sal_Int32  nBytes,
size_t  nAtomSize = 1 
)
overridevirtual

Member Data Documentation

◆ maBuffer

StreamDataSequence oox::BinaryXOutputStream::maBuffer
private

Data buffer used in writeMemory() function.

Definition at line 158 of file binaryoutputstream.hxx.

Referenced by writeMemory().

◆ mbAutoClose

bool oox::BinaryXOutputStream::mbAutoClose
private

True = automatically close stream on destruction.

Definition at line 161 of file binaryoutputstream.hxx.

Referenced by close().

◆ mxOutStrm

css::uno::Reference< css::io::XOutputStream > oox::BinaryXOutputStream::mxOutStrm
private

Reference to the output stream.

Definition at line 160 of file binaryoutputstream.hxx.

Referenced by BinaryXOutputStream(), close(), writeData(), and writeMemory().


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