1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: filstr.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #include <osl/mutex.hxx>
34 #include <rtl/ustring.hxx>
35 #include <cppuhelper/weak.hxx>
36 #include <ucbhelper/macros.hxx>
37 #include <com/sun/star/uno/XInterface.hpp>
38 #include <com/sun/star/lang/XTypeProvider.hpp>
39 #include <com/sun/star/io/XSeekable.hpp>
40 #include <com/sun/star/io/XTruncate.hpp>
41 #include <com/sun/star/io/XInputStream.hpp>
42 #include <com/sun/star/io/XOutputStream.hpp>
43 #include <com/sun/star/io/XStream.hpp>
44 #include "com/sun/star/io/XAsyncOutputMonitor.hpp"
45 #include <com/sun/star/ucb/XContentProvider.hpp>
49 namespace fileaccess
{
53 class XInputStreamForStream
;
54 class XOutputStreamForStream
;
57 : public cppu::OWeakObject
,
58 public com::sun::star::lang::XTypeProvider
,
59 public com::sun::star::io::XStream
,
60 public com::sun::star::io::XSeekable
,
61 public com::sun::star::io::XInputStream
,
62 public com::sun::star::io::XOutputStream
,
63 public com::sun::star::io::XTruncate
,
64 public com::sun::star::io::XAsyncOutputMonitor
66 friend class XInputStreamForStream
;
67 friend class XOutputStreamForStream
;
71 XStream_impl( shell
* pMyShell
,const rtl::OUString
& aUncPath
, sal_Bool bLock
);
74 * Returns an error code as given by filerror.hxx
77 sal_Int32 SAL_CALL
CtorSuccess();
78 sal_Int32 SAL_CALL
getMinorError();
80 virtual ~XStream_impl();
85 virtual com::sun::star::uno::Any SAL_CALL
87 const com::sun::star::uno::Type
& rType
)
88 throw( com::sun::star::uno::RuntimeException
);
108 virtual com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
> SAL_CALL
110 throw( com::sun::star::uno::RuntimeException
);
112 virtual com::sun::star::uno::Reference
< com::sun::star::io::XOutputStream
> SAL_CALL
114 throw( com::sun::star::uno::RuntimeException
);
119 virtual void SAL_CALL
truncate( void )
120 throw( com::sun::star::io::IOException
,
121 com::sun::star::uno::RuntimeException
);
128 com::sun::star::uno::Sequence
< sal_Int8
>& aData
,
129 sal_Int32 nBytesToRead
)
130 throw( com::sun::star::io::NotConnectedException
,
131 com::sun::star::io::BufferSizeExceededException
,
132 com::sun::star::io::IOException
,
133 com::sun::star::uno::RuntimeException
);
137 com::sun::star::uno::Sequence
< sal_Int8
>& aData
,
138 sal_Int32 nMaxBytesToRead
)
139 throw( com::sun::star::io::NotConnectedException
,
140 com::sun::star::io::BufferSizeExceededException
,
141 com::sun::star::io::IOException
,
142 com::sun::star::uno::RuntimeException
);
147 sal_Int32 nBytesToSkip
)
148 throw( com::sun::star::io::NotConnectedException
,
149 com::sun::star::io::BufferSizeExceededException
,
150 com::sun::star::io::IOException
,
151 com::sun::star::uno::RuntimeException
);
156 throw( com::sun::star::io::NotConnectedException
,
157 com::sun::star::io::IOException
,
158 com::sun::star::uno::RuntimeException
);
163 throw( com::sun::star::io::NotConnectedException
,
164 com::sun::star::io::IOException
,
165 com::sun::star::uno::RuntimeException
);
172 throw( com::sun::star::lang::IllegalArgumentException
,
173 com::sun::star::io::IOException
,
174 com::sun::star::uno::RuntimeException
);
179 throw( com::sun::star::io::IOException
,
180 com::sun::star::uno::RuntimeException
);
185 throw( com::sun::star::io::IOException
,
186 com::sun::star::uno::RuntimeException
);
192 writeBytes( const com::sun::star::uno::Sequence
< sal_Int8
>& aData
)
193 throw( com::sun::star::io::NotConnectedException
,
194 com::sun::star::io::BufferSizeExceededException
,
195 com::sun::star::io::IOException
,
196 com::sun::star::uno::RuntimeException
);
202 throw( com::sun::star::io::NotConnectedException
,
203 com::sun::star::io::BufferSizeExceededException
,
204 com::sun::star::io::IOException
,
205 com::sun::star::uno::RuntimeException
);
211 throw( com::sun::star::io::NotConnectedException
,
212 com::sun::star::io::IOException
,
213 com::sun::star::uno::RuntimeException
);
215 virtual void SAL_CALL
waitForCompletion()
217 com::sun::star::io::IOException
,
218 com::sun::star::uno::RuntimeException
);
223 bool m_bInputStreamCalled
,m_bOutputStreamCalled
;
226 com::sun::star::uno::Reference
< com::sun::star::ucb::XContentProvider
> m_xProvider
;
231 ReconnectingFile m_aFile
;
233 sal_Int32 m_nErrorCode
;
234 sal_Int32 m_nMinorErrorCode
;
236 // Implementation methods
241 throw( com::sun::star::io::NotConnectedException
,
242 com::sun::star::io::IOException
,
243 com::sun::star::uno::RuntimeException
);
247 } // end namespace XStream_impl