diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/stream/stream.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 4f95afd2c1e8..4c363dc67484 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1179,6 +1179,27 @@ SvStream& SvStream::WriteStream( SvStream& rStream ) return *this; } +sal_uInt64 SvStream::WriteStream( SvStream& rStream, sal_uInt64 nSize ) +{ + const sal_uInt32 cBufLen = 0x8000; + std::unique_ptr<char[]> pBuf( new char[ cBufLen ] ); + sal_uInt32 nCurBufLen = cBufLen; + sal_uInt32 nCount; + sal_uInt64 nWriteSize = nSize; + + do { + if ( nSize >= nCurBufLen ) + nWriteSize -= nCurBufLen; + else + nCurBufLen = nWriteSize; + nCount = rStream.ReadBytes( pBuf.get(), nCurBufLen ); + WriteBytes( pBuf.get(), nCount ); + } + while( nWriteSize && nCount == nCurBufLen ); + + return nSize - nWriteSize; +} + OUString SvStream::ReadUniOrByteString( rtl_TextEncoding eSrcCharSet ) { // read UTF-16 string directly from stream ? |