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

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

#include <binaryinputstream.hxx>

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

Public Member Functions

 BinaryXInputStream (const css::uno::Reference< css::io::XInputStream > &rxInStrm, bool bAutoClose)
 Constructs the wrapper object for the passed input stream. More...
 
virtual ~BinaryXInputStream () override
 
virtual void close () override
 Closes the input stream. More...
 
virtual sal_Int32 readData (StreamDataSequence &orData, sal_Int32 nBytes, size_t nAtomSize=1) override
 Reads nBytes bytes to the passed sequence. More...
 
virtual sal_Int32 readMemory (void *opMem, sal_Int32 nBytes, size_t nAtomSize=1) override
 Reads nBytes bytes to the (existing) buffer opMem. More...
 
virtual void skip (sal_Int32 nBytes, size_t nAtomSize=1) override
 Seeks the stream forward by the passed number of bytes. 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::BinaryInputStream
virtual sal_Int32 readData (StreamDataSequence &orData, sal_Int32 nBytes, size_t nAtomSize=1)=0
 Derived classes implement reading nBytes bytes to the passed sequence. More...
 
virtual sal_Int32 readMemory (void *opMem, sal_Int32 nBytes, size_t nAtomSize=1)=0
 Derived classes implement reading nBytes bytes to the (preallocated!) memory buffer opMem. More...
 
virtual void skip (sal_Int32 nBytes, size_t nAtomSize=1)=0
 Derived classes implement seeking the stream forward by the passed number of bytes. More...
 
template<typename Type >
Type readValue ()
 Reads a value from the stream and converts it to platform byte order. More...
 
sal_Int8 readInt8 ()
 
sal_uInt8 readuInt8 ()
 
sal_Int16 readInt16 ()
 
sal_uInt16 readuInt16 ()
 
sal_Int32 readInt32 ()
 
sal_uInt32 readuInt32 ()
 
sal_Int64 readInt64 ()
 
float readFloat ()
 
double readDouble ()
 
unsigned char readuChar ()
 
template<typename Type >
sal_Int32 readArray (Type *opnArray, sal_Int32 nElemCount)
 Reads a (preallocated!) C array of values from the stream. More...
 
template<typename Type >
sal_Int32 readArray (::std::vector< Type > &orVector, sal_Int32 nElemCount)
 Reads a vector of values from the stream. More...
 
OUString readNulUnicodeArray ()
 Reads a NUL-terminated Unicode character array and returns the string. More...
 
OString readCharArray (sal_Int32 nChars)
 Reads a byte character array and returns the string. More...
 
OUString readCharArrayUC (sal_Int32 nChars, rtl_TextEncoding eTextEnc)
 Reads a byte character array and returns a Unicode string. More...
 
OUString readUnicodeArray (sal_Int32 nChars)
 Reads a Unicode character array and returns the string. More...
 
OUString readCompressedUnicodeArray (sal_Int32 nChars, bool bCompressed)
 Reads a Unicode character array (may be compressed) and returns the string. More...
 
void copyToStream (BinaryOutputStream &rOutStrm)
 Copies bytes from the current position to the passed output stream. More...
 

Private Attributes

StreamDataSequence maBuffer
 Data buffer used in readMemory() function. More...
 
css::uno::Reference< css::io::XInputStream > mxInStrm
 Reference to the input 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::BinaryInputStream
 BinaryInputStream ()
 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 input stream and provides convenient access functions.

The binary data in the stream is assumed to be in little-endian format.

Definition at line 237 of file binaryinputstream.hxx.

Constructor & Destructor Documentation

◆ BinaryXInputStream()

oox::BinaryXInputStream::BinaryXInputStream ( const css::uno::Reference< css::io::XInputStream > &  rxInStrm,
bool  bAutoClose 
)
explicit

Constructs the wrapper object for the passed input stream.

Parameters
rxInStreamThe com.sun.star.io.XInputStream interface of the UNO input stream to be wrapped.
bAutoCloseTrue = automatically close the wrapped input stream on destruction of this wrapper or when close() is called.

Definition at line 122 of file binaryinputstream.cxx.

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

◆ ~BinaryXInputStream()

oox::BinaryXInputStream::~BinaryXInputStream ( )
overridevirtual

Definition at line 132 of file binaryinputstream.cxx.

References close().

Member Function Documentation

◆ close()

void oox::BinaryXInputStream::close ( )
overridevirtual

Closes the input stream.

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

Reimplemented from oox::BinaryXSeekableStream.

Definition at line 137 of file binaryinputstream.cxx.

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

Referenced by ~BinaryXInputStream().

◆ readData()

sal_Int32 oox::BinaryXInputStream::readData ( StreamDataSequence orData,
sal_Int32  nBytes,
size_t  nAtomSize = 1 
)
overridevirtual

Reads nBytes bytes to the passed sequence.

Returns
Number of bytes really read.

Implements oox::BinaryInputStream.

Definition at line 153 of file binaryinputstream.cxx.

References Exception, oox::BinaryStreamBase::mbEof, and mxInStrm.

Referenced by oox::crypto::DocumentDecryption::DocumentDecryption(), and readMemory().

◆ readMemory()

sal_Int32 oox::BinaryXInputStream::readMemory ( void *  opMem,
sal_Int32  nBytes,
size_t  nAtomSize = 1 
)
overridevirtual

Reads nBytes bytes to the (existing) buffer opMem.

Returns
Number of bytes really read.

Implements oox::BinaryInputStream.

Definition at line 168 of file binaryinputstream.cxx.

References maBuffer, oox::BinaryStreamBase::mbEof, and readData().

Referenced by oox::crypto::AgileEngine::decrypt(), oox::crypto::Standard2007Engine::decrypt(), oox::crypto::AgileEngine::encrypt(), and oox::crypto::Standard2007Engine::encrypt().

◆ skip()

void oox::BinaryXInputStream::skip ( sal_Int32  nBytes,
size_t  nAtomSize = 1 
)
overridevirtual

Member Data Documentation

◆ maBuffer

StreamDataSequence oox::BinaryXInputStream::maBuffer
private

Data buffer used in readMemory() function.

Definition at line 273 of file binaryinputstream.hxx.

Referenced by readMemory().

◆ mbAutoClose

bool oox::BinaryXInputStream::mbAutoClose
private

True = automatically close stream on destruction.

Definition at line 276 of file binaryinputstream.hxx.

Referenced by close().

◆ mxInStrm

css::uno::Reference< css::io::XInputStream > oox::BinaryXInputStream::mxInStrm
private

Reference to the input stream.

Definition at line 275 of file binaryinputstream.hxx.

Referenced by BinaryXInputStream(), close(), readData(), and skip().


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