diff options
Diffstat (limited to 'comphelper/source/streaming/seekableinput.cxx')
-rw-r--r-- | comphelper/source/streaming/seekableinput.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/comphelper/source/streaming/seekableinput.cxx b/comphelper/source/streaming/seekableinput.cxx index 6fd418df36ca..dceb16824c58 100644 --- a/comphelper/source/streaming/seekableinput.cxx +++ b/comphelper/source/streaming/seekableinput.cxx @@ -107,7 +107,11 @@ void OSeekableInputWrapper::PrepareCopy_Impl() xTempSeek->seek( 0 ); m_xCopyInput.set( xTempOut, uno::UNO_QUERY ); if ( m_xCopyInput.is() ) + { m_xCopySeek = xTempSeek; + m_pCopyByteReader = dynamic_cast<comphelper::ByteReader*>(xTempOut.get()); + assert(m_pCopyByteReader); + } } } @@ -142,6 +146,18 @@ sal_Int32 SAL_CALL OSeekableInputWrapper::readSomeBytes( uno::Sequence< sal_Int8 return m_xCopyInput->readSomeBytes( aData, nMaxBytesToRead ); } +sal_Int32 OSeekableInputWrapper::readSomeBytes( sal_Int8* aData, sal_Int32 nMaxBytesToRead ) +{ + std::scoped_lock aGuard( m_aMutex ); + + if ( !m_xOriginalStream.is() ) + throw io::NotConnectedException(); + + PrepareCopy_Impl(); + + return m_pCopyByteReader->readSomeBytes( aData, nMaxBytesToRead ); +} + void SAL_CALL OSeekableInputWrapper::skipBytes( sal_Int32 nBytesToSkip ) { @@ -186,6 +202,7 @@ void SAL_CALL OSeekableInputWrapper::closeInput() } m_xCopySeek.clear(); + m_pCopyByteReader = nullptr; } |