diff options
Diffstat (limited to 'package/source/zippackage/wrapstreamforshare.cxx')
-rw-r--r-- | package/source/zippackage/wrapstreamforshare.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/package/source/zippackage/wrapstreamforshare.cxx b/package/source/zippackage/wrapstreamforshare.cxx index 250ccb4ba5ce..026aee989b01 100644 --- a/package/source/zippackage/wrapstreamforshare.cxx +++ b/package/source/zippackage/wrapstreamforshare.cxx @@ -46,6 +46,8 @@ WrapStreamForShare::WrapStreamForShare( uno::Reference< io::XInputStream > xInSt throw uno::RuntimeException(THROW_WHERE ); } m_xSeekable.set( m_xInStream, uno::UNO_QUERY_THROW ); + mpByteReader = dynamic_cast<comphelper::ByteReader*>(m_xInStream.get()); + assert(mpByteReader); } WrapStreamForShare::~WrapStreamForShare() @@ -79,6 +81,19 @@ sal_Int32 SAL_CALL WrapStreamForShare::readSomeBytes( uno::Sequence< sal_Int8 >& return nRead; } +sal_Int32 WrapStreamForShare::readSomeBytes( sal_Int8* aData, sal_Int32 nMaxBytesToRead ) +{ + if ( !m_xInStream.is() ) + throw io::IOException(THROW_WHERE ); + + m_xSeekable->seek( m_nCurPos ); + + sal_Int32 nRead = mpByteReader->readSomeBytes( aData, nMaxBytesToRead ); + m_nCurPos += nRead; + + return nRead; +} + void SAL_CALL WrapStreamForShare::skipBytes( sal_Int32 nBytesToSkip ) { ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); @@ -113,6 +128,7 @@ void SAL_CALL WrapStreamForShare::closeInput() // m_xInStream->closeInput(); m_xInStream.clear(); m_xSeekable.clear(); + mpByteReader = nullptr; } // XSeekable |