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