diff options
Diffstat (limited to 'sot/source/sdstor')
-rw-r--r-- | sot/source/sdstor/ucbstorage.cxx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index a6aa800e2436..51c43bb290e3 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -87,7 +87,7 @@ typedef ::cppu::WeakImplHelper < XInputStream, XSeekable > FileInputStreamWrappe namespace { -class FileStreamWrapper_Impl : public FileInputStreamWrapper_Base +class FileStreamWrapper_Impl : public FileInputStreamWrapper_Base, public comphelper::ByteReader { protected: std::mutex m_aMutex; @@ -107,6 +107,8 @@ public: virtual sal_Int32 SAL_CALL available() override; virtual void SAL_CALL closeInput() override; + virtual sal_Int32 readSomeBytes(sal_Int8* aData, sal_Int32 nBytesToRead) override; + protected: void checkConnected(); void checkError(); @@ -164,6 +166,23 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::readBytes(Sequence< sal_Int8 >& aData return nRead; } +sal_Int32 FileStreamWrapper_Impl::readSomeBytes(sal_Int8* aData, sal_Int32 nBytesToRead) +{ + if ( m_aURL.isEmpty() ) + return 0; + + checkConnected(); + + if (nBytesToRead < 0) + throw BufferSizeExceededException(OUString(), getXWeak()); + + std::scoped_lock aGuard( m_aMutex ); + + sal_uInt32 nRead = m_pSvStream->ReadBytes(static_cast<void*>(aData), nBytesToRead); + checkError(); + + return nRead; +} sal_Int32 SAL_CALL FileStreamWrapper_Impl::readSomeBytes(Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) { |