22#include <com/sun/star/io/BufferSizeExceededException.hpp>
23#include <com/sun/star/io/NotConnectedException.hpp>
36 :m_pSvStream(&_rStream)
37 ,m_bSvStreamOwner(false)
42 :m_pSvStream( pStream )
43 ,m_bSvStreamOwner( bOwner )
48 :m_pSvStream( pStream.release() )
49 ,m_bSvStreamOwner( true )
64 throw css::io::BufferSizeExceededException(OUString(), getXWeak());
68 if (
aData.getLength() < nBytesToRead)
69 aData.realloc(nBytesToRead);
76 aData.realloc( nRead );
86 throw css::io::BufferSizeExceededException(OUString(), getXWeak());
100 if (nMaxBytesToRead < 0)
101 throw css::io::BufferSizeExceededException(OUString(), getXWeak());
114 std::scoped_lock aGuard(
m_aMutex );
123 std::scoped_lock aGuard(
m_aMutex );
134 std::scoped_lock aGuard(
m_aMutex );
147 throw css::io::NotConnectedException(OUString(),
const_cast<OInputStreamWrapper*
>(
this)->getXWeak());
157 throw css::io::NotConnectedException(
"utl::OInputStreamWrapper error " + e.toString(),
const_cast<OInputStreamWrapper*
>(
this)->getXWeak());
166 SetStream( &_rStream,
false );
171 SetStream( _pStream, _bOwner );
176 std::scoped_lock aGuard(
m_aMutex );
179 m_pSvStream->Seek(
static_cast<sal_uInt64
>(_nLocation));
185 std::scoped_lock aGuard(
m_aMutex );
188 sal_uInt32
nPos = m_pSvStream->Tell();
190 return static_cast<sal_Int64
>(
nPos);
195 std::scoped_lock aGuard(
m_aMutex );
200 sal_Int64 nEndPos = m_pSvStream->TellEnd();
218 || (nWritten !=
static_cast<sal_uInt32
>(
aData.getLength()))
221 throw css::io::BufferSizeExceededException(OUString(), getXWeak());
239 throw css::io::NotConnectedException(OUString(),
const_cast<OOutputStreamWrapper*
>(
this)->getXWeak());
253 Any aReturn = OOutputStreamWrapper::queryInterface(_rType);
254 if (!aReturn.hasValue())
269 return static_cast<sal_Int64
>(
nPos);
285 SetStream( &_rStream,
false );
290 SetStream( pStream.release(),
true );
295 SetStream( pStream, bOwner );
310 sal_uInt32 nWritten = m_pSvStream->WriteBytes(
aData.getConstArray(),
aData.getLength());
313 || (nWritten !=
static_cast<sal_uInt32
>(
aData.getLength()))
316 throw css::io::BufferSizeExceededException(OUString(), getXWeak());
322 m_pSvStream->FlushBuffer();
324 throw css::io::NotConnectedException(OUString(), getXWeak());
333 m_pSvStream->SetStreamSize(0);
virtual sal_uInt64 TellEnd()
std::size_t WriteBytes(const void *pData, std::size_t nSize)
sal_uInt64 Seek(sal_uInt64 nPos)
std::size_t ReadBytes(void *pData, std::size_t nSize)
sal_uInt64 SeekRel(sal_Int64 nPos)
sal_uInt64 remainingSize()
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
UNOTOOLS_DLLPUBLIC OOutputStreamWrapper(SvStream &_rStream)
void checkError() const
throws an exception according to the error flag of m_pSvStream
virtual void SAL_CALL closeOutput() override
virtual ~OOutputStreamWrapper() override
virtual void SAL_CALL flush() override
virtual void SAL_CALL writeBytes(const css::uno::Sequence< sal_Int8 > &aData) override
virtual ~OSeekableOutputStreamWrapper() override
OSeekableOutputStreamWrapper(SvStream &_rStream)
virtual sal_Int64 SAL_CALL getLength() override
virtual void SAL_CALL seek(sal_Int64 _nLocation) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &_rType) override
virtual sal_Int64 SAL_CALL getPosition() override
~OStreamWrapper() override
virtual void SAL_CALL writeBytes(const css::uno::Sequence< sal_Int8 > &aData) override
OStreamWrapper(SvStream &_rStream)
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getInputStream() override
virtual void SAL_CALL closeOutput() override
virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL getOutputStream() override
virtual void SAL_CALL flush() override
virtual void SAL_CALL truncate() override
std::unique_ptr< sal_Int32[]> pData
constexpr OUStringLiteral aData
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)