/** Base class for wrappers around memory data that want to be exposed as an XInputStream */ class COMPHELPER_DLLPUBLIC MemoryInputStream
: public ::cppu::WeakImplHelper< css::io::XInputStream, css::io::XSeekable >, public comphelper::ByteReader
{
std::mutex m_aMutex; const sal_Int8* m_pMemoryData;
sal_Int32 m_nMemoryDataLength;
sal_Int32 m_nPos;
// Stream for reading data from a sequence of bytes class COMPHELPER_DLLPUBLIC SequenceInputStream final
: public MemoryInputStream
{
css::uno::Sequence<sal_Int8> const m_aData;
// don't export to avoid duplicate WeakImplHelper definitions with MSVC class SAL_DLLPUBLIC_TEMPLATE OSequenceOutputStream_Base
: public ::cppu::WeakImplHelper< css::io::XOutputStream >
{};
class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OSequenceOutputStream final : public OSequenceOutputStream_Base
{ private:
css::uno::Sequence< sal_Int8 >& m_rSequence; double m_nResizeFactor;
sal_Int32 const m_nMinimumResize;
sal_Int32 m_nSize; // the size of the virtual stream. This is not the size of the sequence, but the number of bytes written // into the stream at a given moment.
bool m_bConnected; // closeOutput has been called ?
std::mutex m_aMutex;
void finalizeOutput(); virtual ~OSequenceOutputStream() override { if (m_bConnected) finalizeOutput(); }
public: /** constructs the object. Everything written into the stream through the XOutputStream methods will be forwarded tothesequence,reallocatingitifnecessary.Writingwillstartatoffset0withinthesequence. @param_rSeqareferencetothesequencewhichwillbeusedforoutput. Thecallerisresponsiblefortakingcareofthelifetimeofthestream objectandthesequence.Ifyou'reindoubtaboutthis,use<code>closeOutput</code> beforedestroyingthesequence @param_nResizeFactorthefactorwhichisusedforresizingthesequencewhennecessary.Inevery resizestep,thenewsequencesizewillbecalculatedbymultiplyingthecurrent sizewiththisfactor,roundedofftothenextmultipleof4. @param_nMinimumResizetheminimalnumberofbyteswhichisadditionallyallocatedonresizing @seecloseOutput
*/
OSequenceOutputStream(
css::uno::Sequence< sal_Int8 >& _rSeq, double _nResizeFactor = 1.3,
sal_Int32 _nMinimumResize = 128
);
/// same as XOutputStream::writeBytes (as expected :) virtualvoid SAL_CALL writeBytes( const css::uno::Sequence< sal_Int8 >& aData ) override; /// this is a dummy in this implementation, no buffering is used virtualvoid SAL_CALL flush( ) override; /** closes the output stream. In the case of this class, this means that the sequence used for writing is resizedtothereallyusedsizeandnotusedanyfurther,everysubsequentcalltooneoftheXOutputStream methodswillthrowa<code>NotConnectedException</code>.
*/ virtualvoid SAL_CALL closeOutput( ) override;
};
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.