1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef GIO_OUTPUTSTREAM_HXX
25 #define GIO_OUTPUTSTREAM_HXX
26 
27 #include <sal/types.h>
28 #include <rtl/ustring.hxx>
29 #include <cppuhelper/weak.hxx>
30 
31 #include <com/sun/star/io/XOutputStream.hpp>
32 #include <com/sun/star/io/XTruncate.hpp>
33 #include <com/sun/star/io/XSeekable.hpp>
34 
35 #include "gio_seekable.hxx"
36 
37 namespace gio
38 {
39 
40 class OutputStream :
41     public ::com::sun::star::io::XOutputStream,
42     public Seekable
43 {
44 private:
45     GFileOutputStream *mpStream;
46 
47 public:
48     OutputStream ( GFileOutputStream *pStream );
49     virtual ~OutputStream();
50 
51     // XInterface
52     virtual com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type & type )
53             throw( ::com::sun::star::uno::RuntimeException );
acquire(void)54     virtual void SAL_CALL acquire( void ) throw () { OWeakObject::acquire(); }
release(void)55     virtual void SAL_CALL release( void ) throw() { OWeakObject::release(); }
56 
57     // XOutputStream
58    virtual void SAL_CALL writeBytes( const com::sun::star::uno::Sequence< sal_Int8 >& aData )
59            throw( com::sun::star::io::NotConnectedException,
60                   com::sun::star::io::BufferSizeExceededException,
61                   com::sun::star::io::IOException,
62                   com::sun::star::uno::RuntimeException);
63 
64    virtual void SAL_CALL flush( void )
65            throw( com::sun::star::io::NotConnectedException,
66                   com::sun::star::io::BufferSizeExceededException,
67                   com::sun::star::io::IOException,
68                   com::sun::star::uno::RuntimeException);
69 
70 
71     virtual void SAL_CALL closeOutput( void )
72            throw( com::sun::star::io::NotConnectedException,
73                   com::sun::star::io::IOException,
74                   com::sun::star::uno::RuntimeException );
75 };
76 
77 } // namespace gio
78 #endif
79