xref: /AOO41X/main/unotools/source/streaming/streamwrap.cxx (revision b5088357f810cb81479bbbd0e021cd3c9835ca0d)
1*b5088357SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*b5088357SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b5088357SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b5088357SAndrew Rist  * distributed with this work for additional information
6*b5088357SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b5088357SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b5088357SAndrew Rist  * "License"); you may not use this file except in compliance
9*b5088357SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*b5088357SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*b5088357SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b5088357SAndrew Rist  * software distributed under the License is distributed on an
15*b5088357SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b5088357SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b5088357SAndrew Rist  * specific language governing permissions and limitations
18*b5088357SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*b5088357SAndrew Rist  *************************************************************/
21*b5088357SAndrew Rist 
22*b5088357SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_unotools.hxx"
26cdf0e10cSrcweir #include <unotools/streamwrap.hxx>
27cdf0e10cSrcweir #include <tools/stream.hxx>
28cdf0e10cSrcweir #include <tools/debug.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir namespace utl
31cdf0e10cSrcweir {
32cdf0e10cSrcweir 
33cdf0e10cSrcweir using namespace ::com::sun::star::uno;
34cdf0e10cSrcweir using namespace ::com::sun::star::io;
35cdf0e10cSrcweir using namespace ::com::sun::star::lang;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir //==================================================================
38cdf0e10cSrcweir //= OInputStreamWrapper
39cdf0e10cSrcweir //==================================================================
DBG_NAME(OInputStreamWrapper)40cdf0e10cSrcweir DBG_NAME(OInputStreamWrapper)
41cdf0e10cSrcweir //------------------------------------------------------------------
42cdf0e10cSrcweir OInputStreamWrapper::OInputStreamWrapper( SvStream& _rStream )
43cdf0e10cSrcweir 				 :m_pSvStream(&_rStream)
44cdf0e10cSrcweir 				 ,m_bSvStreamOwner(sal_False)
45cdf0e10cSrcweir {
46cdf0e10cSrcweir 	DBG_CTOR(OInputStreamWrapper,NULL);
47cdf0e10cSrcweir 
48cdf0e10cSrcweir }
49cdf0e10cSrcweir 
50cdf0e10cSrcweir //------------------------------------------------------------------
OInputStreamWrapper(SvStream * pStream,sal_Bool bOwner)51cdf0e10cSrcweir OInputStreamWrapper::OInputStreamWrapper( SvStream* pStream, sal_Bool bOwner )
52cdf0e10cSrcweir 				 :m_pSvStream( pStream )
53cdf0e10cSrcweir 				 ,m_bSvStreamOwner( bOwner )
54cdf0e10cSrcweir {
55cdf0e10cSrcweir 	DBG_CTOR(OInputStreamWrapper,NULL);
56cdf0e10cSrcweir 
57cdf0e10cSrcweir }
58cdf0e10cSrcweir 
59cdf0e10cSrcweir //------------------------------------------------------------------
~OInputStreamWrapper()60cdf0e10cSrcweir OInputStreamWrapper::~OInputStreamWrapper()
61cdf0e10cSrcweir {
62cdf0e10cSrcweir 	if( m_bSvStreamOwner )
63cdf0e10cSrcweir 		delete m_pSvStream;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 	DBG_DTOR(OInputStreamWrapper,NULL);
66cdf0e10cSrcweir }
67cdf0e10cSrcweir 
68cdf0e10cSrcweir //------------------------------------------------------------------------------
readBytes(staruno::Sequence<sal_Int8> & aData,sal_Int32 nBytesToRead)69cdf0e10cSrcweir sal_Int32 SAL_CALL OInputStreamWrapper::readBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead)
70cdf0e10cSrcweir 				throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
71cdf0e10cSrcweir {
72cdf0e10cSrcweir 	checkConnected();
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	if (nBytesToRead < 0)
75cdf0e10cSrcweir 		throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	aData.realloc(nBytesToRead);
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 	sal_uInt32 nRead = m_pSvStream->Read((void*)aData.getArray(), nBytesToRead);
82cdf0e10cSrcweir 	checkError();
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	// Wenn gelesene Zeichen < MaxLength, staruno::Sequence anpassen
85cdf0e10cSrcweir 	if (nRead < (sal_uInt32)nBytesToRead)
86cdf0e10cSrcweir 		aData.realloc( nRead );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	return nRead;
89cdf0e10cSrcweir }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir //------------------------------------------------------------------------------
readSomeBytes(staruno::Sequence<sal_Int8> & aData,sal_Int32 nMaxBytesToRead)92cdf0e10cSrcweir sal_Int32 SAL_CALL OInputStreamWrapper::readSomeBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
93cdf0e10cSrcweir {
94cdf0e10cSrcweir 	checkError();
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	if (nMaxBytesToRead < 0)
97cdf0e10cSrcweir 		throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	if (m_pSvStream->IsEof())
100cdf0e10cSrcweir 	{
101cdf0e10cSrcweir 		aData.realloc(0);
102cdf0e10cSrcweir 		return 0;
103cdf0e10cSrcweir 	}
104cdf0e10cSrcweir 	else
105cdf0e10cSrcweir 		return readBytes(aData, nMaxBytesToRead);
106cdf0e10cSrcweir }
107cdf0e10cSrcweir 
108cdf0e10cSrcweir //------------------------------------------------------------------------------
skipBytes(sal_Int32 nBytesToSkip)109cdf0e10cSrcweir void SAL_CALL OInputStreamWrapper::skipBytes(sal_Int32 nBytesToSkip) throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
110cdf0e10cSrcweir {
111cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
112cdf0e10cSrcweir 	checkError();
113cdf0e10cSrcweir 
114cdf0e10cSrcweir #ifdef DBG_UTIL
115cdf0e10cSrcweir 	sal_uInt32 nCurrentPos = m_pSvStream->Tell();
116cdf0e10cSrcweir #endif
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 	m_pSvStream->SeekRel(nBytesToSkip);
119cdf0e10cSrcweir 	checkError();
120cdf0e10cSrcweir 
121cdf0e10cSrcweir #ifdef DBG_UTIL
122cdf0e10cSrcweir 	nCurrentPos = m_pSvStream->Tell();
123cdf0e10cSrcweir #endif
124cdf0e10cSrcweir }
125cdf0e10cSrcweir 
126cdf0e10cSrcweir //------------------------------------------------------------------------------
available()127cdf0e10cSrcweir sal_Int32 SAL_CALL OInputStreamWrapper::available() throw( stario::NotConnectedException, staruno::RuntimeException )
128cdf0e10cSrcweir {
129cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
130cdf0e10cSrcweir 	checkConnected();
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	sal_uInt32 nPos = m_pSvStream->Tell();
133cdf0e10cSrcweir 	checkError();
134cdf0e10cSrcweir 
135cdf0e10cSrcweir 	m_pSvStream->Seek(STREAM_SEEK_TO_END);
136cdf0e10cSrcweir 	checkError();
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 	sal_Int32 nAvailable = (sal_Int32)m_pSvStream->Tell() - nPos;
139cdf0e10cSrcweir 	m_pSvStream->Seek(nPos);
140cdf0e10cSrcweir 	checkError();
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 	return nAvailable;
143cdf0e10cSrcweir }
144cdf0e10cSrcweir 
145cdf0e10cSrcweir //------------------------------------------------------------------------------
closeInput()146cdf0e10cSrcweir void SAL_CALL OInputStreamWrapper::closeInput() throw( stario::NotConnectedException, staruno::RuntimeException )
147cdf0e10cSrcweir {
148cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
149cdf0e10cSrcweir 	checkConnected();
150cdf0e10cSrcweir 
151cdf0e10cSrcweir 	if (m_bSvStreamOwner)
152cdf0e10cSrcweir 		delete m_pSvStream;
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 	m_pSvStream = NULL;
155cdf0e10cSrcweir }
156cdf0e10cSrcweir 
157cdf0e10cSrcweir //------------------------------------------------------------------------------
checkConnected() const158cdf0e10cSrcweir void OInputStreamWrapper::checkConnected() const
159cdf0e10cSrcweir {
160cdf0e10cSrcweir 	if (!m_pSvStream)
161cdf0e10cSrcweir 		throw stario::NotConnectedException(::rtl::OUString(), const_cast<staruno::XWeak*>(static_cast<const staruno::XWeak*>(this)));
162cdf0e10cSrcweir }
163cdf0e10cSrcweir 
164cdf0e10cSrcweir //------------------------------------------------------------------------------
checkError() const165cdf0e10cSrcweir void OInputStreamWrapper::checkError() const
166cdf0e10cSrcweir {
167cdf0e10cSrcweir 	checkConnected();
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 	if (m_pSvStream->SvStream::GetError() != ERRCODE_NONE)
170cdf0e10cSrcweir 		// TODO: really evaluate the error
171cdf0e10cSrcweir 		throw stario::NotConnectedException(::rtl::OUString(), const_cast<staruno::XWeak*>(static_cast<const staruno::XWeak*>(this)));
172cdf0e10cSrcweir }
173cdf0e10cSrcweir 
174cdf0e10cSrcweir //==================================================================
175cdf0e10cSrcweir //= OSeekableInputStreamWrapper
176cdf0e10cSrcweir //==================================================================
177cdf0e10cSrcweir //------------------------------------------------------------------------------
OSeekableInputStreamWrapper(SvStream & _rStream)178cdf0e10cSrcweir OSeekableInputStreamWrapper::OSeekableInputStreamWrapper(SvStream& _rStream)
179cdf0e10cSrcweir {
180cdf0e10cSrcweir     SetStream( &_rStream, sal_False );
181cdf0e10cSrcweir }
182cdf0e10cSrcweir 
183cdf0e10cSrcweir //------------------------------------------------------------------------------
OSeekableInputStreamWrapper(SvStream * _pStream,sal_Bool _bOwner)184cdf0e10cSrcweir OSeekableInputStreamWrapper::OSeekableInputStreamWrapper(SvStream* _pStream, sal_Bool _bOwner)
185cdf0e10cSrcweir {
186cdf0e10cSrcweir     SetStream( _pStream, _bOwner );
187cdf0e10cSrcweir }
188cdf0e10cSrcweir 
189cdf0e10cSrcweir //------------------------------------------------------------------------------
seek(sal_Int64 _nLocation)190cdf0e10cSrcweir void SAL_CALL OSeekableInputStreamWrapper::seek( sal_Int64 _nLocation ) throw (IllegalArgumentException, IOException, RuntimeException)
191cdf0e10cSrcweir {
192cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
193cdf0e10cSrcweir 	checkConnected();
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 	m_pSvStream->Seek((sal_uInt32)_nLocation);
196cdf0e10cSrcweir 	checkError();
197cdf0e10cSrcweir }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir //------------------------------------------------------------------------------
getPosition()200cdf0e10cSrcweir sal_Int64 SAL_CALL OSeekableInputStreamWrapper::getPosition(  ) throw (IOException, RuntimeException)
201cdf0e10cSrcweir {
202cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
203cdf0e10cSrcweir 	checkConnected();
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 	sal_uInt32 nPos = m_pSvStream->Tell();
206cdf0e10cSrcweir 	checkError();
207cdf0e10cSrcweir 	return (sal_Int64)nPos;
208cdf0e10cSrcweir }
209cdf0e10cSrcweir 
210cdf0e10cSrcweir //------------------------------------------------------------------------------
getLength()211cdf0e10cSrcweir sal_Int64 SAL_CALL OSeekableInputStreamWrapper::getLength(  ) throw (IOException, RuntimeException)
212cdf0e10cSrcweir {
213cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
214cdf0e10cSrcweir 	checkConnected();
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 	sal_uInt32 nCurrentPos = m_pSvStream->Tell();
217cdf0e10cSrcweir 	checkError();
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 	m_pSvStream->Seek(STREAM_SEEK_TO_END);
220cdf0e10cSrcweir 	sal_uInt32 nEndPos = m_pSvStream->Tell();
221cdf0e10cSrcweir 	m_pSvStream->Seek(nCurrentPos);
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 	checkError();
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 	return (sal_Int64)nEndPos;
226cdf0e10cSrcweir }
227cdf0e10cSrcweir 
228cdf0e10cSrcweir //==================================================================
229cdf0e10cSrcweir //= OOutputStreamWrapper
230cdf0e10cSrcweir //==================================================================
231cdf0e10cSrcweir //------------------------------------------------------------------------------
writeBytes(const staruno::Sequence<sal_Int8> & aData)232cdf0e10cSrcweir void SAL_CALL OOutputStreamWrapper::writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
233cdf0e10cSrcweir {
234cdf0e10cSrcweir 	sal_uInt32 nWritten = rStream.Write(aData.getConstArray(),aData.getLength());
235cdf0e10cSrcweir 	ErrCode err = rStream.GetError();
236cdf0e10cSrcweir 	if	(	(ERRCODE_NONE != err)
237cdf0e10cSrcweir 		||	(nWritten != (sal_uInt32)aData.getLength())
238cdf0e10cSrcweir 		)
239cdf0e10cSrcweir 	{
240cdf0e10cSrcweir 		throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
241cdf0e10cSrcweir 	}
242cdf0e10cSrcweir }
243cdf0e10cSrcweir 
244cdf0e10cSrcweir //------------------------------------------------------------------
flush()245cdf0e10cSrcweir void SAL_CALL OOutputStreamWrapper::flush() throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
246cdf0e10cSrcweir {
247cdf0e10cSrcweir 	rStream.Flush();
248cdf0e10cSrcweir     checkError();
249cdf0e10cSrcweir }
250cdf0e10cSrcweir 
251cdf0e10cSrcweir //------------------------------------------------------------------
closeOutput()252cdf0e10cSrcweir void SAL_CALL OOutputStreamWrapper::closeOutput() throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
253cdf0e10cSrcweir {
254cdf0e10cSrcweir }
255cdf0e10cSrcweir 
256cdf0e10cSrcweir //------------------------------------------------------------------------------
checkError() const257cdf0e10cSrcweir void OOutputStreamWrapper::checkError() const
258cdf0e10cSrcweir {
259cdf0e10cSrcweir 	if (rStream.GetError() != ERRCODE_NONE)
260cdf0e10cSrcweir 		// TODO: really evaluate the error
261cdf0e10cSrcweir 		throw stario::NotConnectedException(::rtl::OUString(), const_cast<staruno::XWeak*>(static_cast<const staruno::XWeak*>(this)));
262cdf0e10cSrcweir }
263cdf0e10cSrcweir 
264cdf0e10cSrcweir //==================================================================
265cdf0e10cSrcweir //= OSeekableOutputStreamWrapper
266cdf0e10cSrcweir //==================================================================
267cdf0e10cSrcweir //------------------------------------------------------------------------------
OSeekableOutputStreamWrapper(SvStream & _rStream)268cdf0e10cSrcweir OSeekableOutputStreamWrapper::OSeekableOutputStreamWrapper(SvStream& _rStream)
269cdf0e10cSrcweir 	:OOutputStreamWrapper(_rStream)
270cdf0e10cSrcweir {
271cdf0e10cSrcweir }
272cdf0e10cSrcweir 
273cdf0e10cSrcweir //------------------------------------------------------------------------------
queryInterface(const Type & _rType)274cdf0e10cSrcweir Any SAL_CALL OSeekableOutputStreamWrapper::queryInterface( const Type& _rType ) throw (RuntimeException)
275cdf0e10cSrcweir {
276cdf0e10cSrcweir 	Any aReturn = OOutputStreamWrapper::queryInterface(_rType);
277cdf0e10cSrcweir 	if (!aReturn.hasValue())
278cdf0e10cSrcweir 		aReturn = OSeekableOutputStreamWrapper_Base::queryInterface(_rType);
279cdf0e10cSrcweir 	return aReturn;
280cdf0e10cSrcweir }
281cdf0e10cSrcweir 
282cdf0e10cSrcweir //------------------------------------------------------------------------------
acquire()283cdf0e10cSrcweir void SAL_CALL OSeekableOutputStreamWrapper::acquire(  ) throw ()
284cdf0e10cSrcweir {
285cdf0e10cSrcweir 	OOutputStreamWrapper::acquire();
286cdf0e10cSrcweir }
287cdf0e10cSrcweir 
288cdf0e10cSrcweir //------------------------------------------------------------------------------
release()289cdf0e10cSrcweir void SAL_CALL OSeekableOutputStreamWrapper::release(  ) throw ()
290cdf0e10cSrcweir {
291cdf0e10cSrcweir 	OOutputStreamWrapper::release();
292cdf0e10cSrcweir }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir //------------------------------------------------------------------------------
seek(sal_Int64 _nLocation)295cdf0e10cSrcweir void SAL_CALL OSeekableOutputStreamWrapper::seek( sal_Int64 _nLocation ) throw (IllegalArgumentException, IOException, RuntimeException)
296cdf0e10cSrcweir {
297cdf0e10cSrcweir 	rStream.Seek((sal_uInt32)_nLocation);
298cdf0e10cSrcweir 	checkError();
299cdf0e10cSrcweir }
300cdf0e10cSrcweir 
301cdf0e10cSrcweir //------------------------------------------------------------------------------
getPosition()302cdf0e10cSrcweir sal_Int64 SAL_CALL OSeekableOutputStreamWrapper::getPosition(  ) throw (IOException, RuntimeException)
303cdf0e10cSrcweir {
304cdf0e10cSrcweir 	sal_uInt32 nPos = rStream.Tell();
305cdf0e10cSrcweir 	checkError();
306cdf0e10cSrcweir 	return (sal_Int64)nPos;
307cdf0e10cSrcweir }
308cdf0e10cSrcweir 
309cdf0e10cSrcweir //------------------------------------------------------------------------------
getLength()310cdf0e10cSrcweir sal_Int64 SAL_CALL OSeekableOutputStreamWrapper::getLength(  ) throw (IOException, RuntimeException)
311cdf0e10cSrcweir {
312cdf0e10cSrcweir 	sal_uInt32 nCurrentPos = rStream.Tell();
313cdf0e10cSrcweir 	checkError();
314cdf0e10cSrcweir 
315cdf0e10cSrcweir 	rStream.Seek(STREAM_SEEK_TO_END);
316cdf0e10cSrcweir 	sal_uInt32 nEndPos = rStream.Tell();
317cdf0e10cSrcweir 	rStream.Seek(nCurrentPos);
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 	checkError();
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 	return (sal_Int64)nEndPos;
322cdf0e10cSrcweir }
323cdf0e10cSrcweir 
324cdf0e10cSrcweir //------------------------------------------------------------------------------
OStreamWrapper(SvStream & _rStream)325cdf0e10cSrcweir OStreamWrapper::OStreamWrapper(SvStream& _rStream)
326cdf0e10cSrcweir {
327cdf0e10cSrcweir     SetStream( &_rStream, sal_False );
328cdf0e10cSrcweir }
329cdf0e10cSrcweir 
330cdf0e10cSrcweir //------------------------------------------------------------------------------
getInputStream()331cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL OStreamWrapper::getInputStream(  ) throw (::com::sun::star::uno::RuntimeException)
332cdf0e10cSrcweir {
333cdf0e10cSrcweir     return this;
334cdf0e10cSrcweir }
335cdf0e10cSrcweir 
336cdf0e10cSrcweir //------------------------------------------------------------------------------
getOutputStream()337cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL OStreamWrapper::getOutputStream(  ) throw (::com::sun::star::uno::RuntimeException)
338cdf0e10cSrcweir {
339cdf0e10cSrcweir     return this;
340cdf0e10cSrcweir }
341cdf0e10cSrcweir 
342cdf0e10cSrcweir //------------------------------------------------------------------------------
writeBytes(const staruno::Sequence<sal_Int8> & aData)343cdf0e10cSrcweir void SAL_CALL OStreamWrapper::writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException)
344cdf0e10cSrcweir {
345cdf0e10cSrcweir     sal_uInt32 nWritten = m_pSvStream->Write(aData.getConstArray(),aData.getLength());
346cdf0e10cSrcweir     ErrCode err = m_pSvStream->GetError();
347cdf0e10cSrcweir 	if	(	(ERRCODE_NONE != err)
348cdf0e10cSrcweir 		||	(nWritten != (sal_uInt32)aData.getLength())
349cdf0e10cSrcweir 		)
350cdf0e10cSrcweir 	{
351cdf0e10cSrcweir 		throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
352cdf0e10cSrcweir 	}
353cdf0e10cSrcweir }
354cdf0e10cSrcweir 
355cdf0e10cSrcweir //------------------------------------------------------------------------------
flush()356cdf0e10cSrcweir void SAL_CALL OStreamWrapper::flush() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException)
357cdf0e10cSrcweir {
358cdf0e10cSrcweir     m_pSvStream->Flush();
359cdf0e10cSrcweir     if (m_pSvStream->GetError() != ERRCODE_NONE)
360cdf0e10cSrcweir 		throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
361cdf0e10cSrcweir }
362cdf0e10cSrcweir 
363cdf0e10cSrcweir //------------------------------------------------------------------------------
closeOutput()364cdf0e10cSrcweir void SAL_CALL OStreamWrapper::closeOutput() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException)
365cdf0e10cSrcweir {
366cdf0e10cSrcweir }
367cdf0e10cSrcweir 
368cdf0e10cSrcweir //------------------------------------------------------------------------------
truncate()369cdf0e10cSrcweir void SAL_CALL OStreamWrapper::truncate() throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
370cdf0e10cSrcweir {
371cdf0e10cSrcweir     m_pSvStream->SetStreamSize(0);
372cdf0e10cSrcweir }
373cdf0e10cSrcweir 
374cdf0e10cSrcweir } // namespace utl
375cdf0e10cSrcweir 
376