/** Reads a value from the stream and converts it to platform byte order. AlldatatypessupportedbytheByteOrderConverterclasscanbeused.
*/ template< typename Type >
[[nodiscard]]
Type readValue();
/** Wraps a UNO input stream and provides convenient access functions.
Thebinarydatainthestreamisassumedtobeinlittle-endianformat.
*/ class OOX_DLLPUBLIC BinaryXInputStream final : public BinaryXSeekableStream, public BinaryInputStream
{ public: /** Constructs the wrapper object for the passed input stream.
/** Closes the input stream. Does also close the wrapped UNO input stream
if bAutoClose has been set to true in the constructor. */ virtualvoid close() override;
/** Reads nBytes bytes to the passed sequence.
@return Number of bytes really read. */ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
/** Reads nBytes bytes to the (existing) buffer opMem.
@return Number of bytes really read. */ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
/** Seeks the stream forward by the passed number of bytes. This works for
non-seekable streams too. */ virtualvoid skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
private:
StreamDataSequence maBuffer; ///< Data buffer used in readMemory() function.
css::uno::Reference< css::io::XInputStream >
mxInStrm; ///< Reference to the input stream. bool mbAutoClose; ///< True = automatically close stream on destruction.
};
/** Wraps a StreamDataSequence and provides convenient access functions.
Thebinarydatainthestreamisassumedtobeinlittle-endianformat.
*/ class OOX_DLLPUBLIC SequenceInputStream final : public SequenceSeekableStream, public BinaryInputStream
{ public: /** Constructs the wrapper object for the passed data sequence.
/** Reads nBytes bytes to the passed sequence.
@return Number of bytes really read. */ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
/** Reads nBytes bytes to the (existing) buffer opMem.
@return Number of bytes really read. */ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
/** Seeks the stream forward by the passed number of bytes. This works for
non-seekable streams too. */ virtualvoid skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
private: /** Returns the number of bytes available in the sequence for the passed byte count. */
sal_Int32 getMaxBytes( sal_Int32 nBytes ) const
{ return getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, mpData->getLength() - mnPos ); }
};
/** Wraps a BinaryInputStream and provides access to a specific part of the streamdata.
ThepassedinputstreamMUSTliveatleastaslongasthisstreamwrapper. ThestreamMUSTNOTbechangedfromoutsideaslongasthisstreamwrapper isusedtoreadfromit.
*/ class RelativeInputStream final : public BinaryInputStream
{ public: /** Constructs the wrapper object for the passed stream.
/** Returns the size of the data block in the wrapped stream offered by
this wrapper. */ virtual sal_Int64 size() const override;
/** Returns the current relative stream position. */ virtual sal_Int64 tell() const override;
/** Seeks the stream to the passed relative position, if the wrapped stream
is seekable. */ virtualvoid seek( sal_Int64 nPos ) override;
/** Closes the input stream but not the wrapped stream. */ virtualvoid close() override;
/** Reads nBytes bytes to the passed sequence. Does not read out of the datablockwhosesizehasbeenspecifiedonconstruction.
@return Number of bytes really read. */ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
/** Reads nBytes bytes to the (existing) buffer opMem. Does not read out of thedatablockwhosesizehasbeenspecifiedonconstruction.
@return Number of bytes really read. */ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
/** Seeks the stream forward by the passed number of bytes. This works for
non-seekable streams too. Does not seek out of the data block. */ virtualvoid skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
private: /** Returns the number of bytes available in the sequence for the passed byte count. */
sal_Int32 getMaxBytes( sal_Int32 nBytes ) const
{ return getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, mnSize - mnRelPos ); }
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.