1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef GIO_INPUTSTREAM_HXX
29 #define GIO_INPUTSTREAM_HXX
30 
31 #include <sal/types.h>
32 #include <rtl/ustring.hxx>
33 #include <cppuhelper/weak.hxx>
34 
35 #include <com/sun/star/io/XInputStream.hpp>
36 #include <com/sun/star/io/XTruncate.hpp>
37 #include <com/sun/star/io/XSeekable.hpp>
38 
39 #include "gio_seekable.hxx"
40 
41 namespace gio
42 {
43 
44 class InputStream :
45     public ::com::sun::star::io::XInputStream,
46     public Seekable
47 {
48 private:
49     GFileInputStream *mpStream;
50 
51 public:
52     InputStream ( GFileInputStream *pStream );
53     virtual ~InputStream();
54 
55     // XInterface
56     virtual com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type & type )
57             throw( ::com::sun::star::uno::RuntimeException );
58     virtual void SAL_CALL acquire( void ) throw () { OWeakObject::acquire(); }
59     virtual void SAL_CALL release( void ) throw() { OWeakObject::release(); }
60 
61     // XInputStream
62     virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 > & aData,
63         sal_Int32 nBytesToRead )
64             throw( ::com::sun::star::io::NotConnectedException,
65                 ::com::sun::star::io::BufferSizeExceededException,
66                 ::com::sun::star::io::IOException,
67                 ::com::sun::star::uno::RuntimeException );
68 
69     virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 > & aData,
70         sal_Int32 nMaxBytesToRead )
71             throw( ::com::sun::star::io::NotConnectedException,
72                 ::com::sun::star::io::BufferSizeExceededException,
73                 ::com::sun::star::io::IOException,
74                 ::com::sun::star::uno::RuntimeException );
75 
76     virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
77             throw( ::com::sun::star::io::NotConnectedException,
78                 ::com::sun::star::io::BufferSizeExceededException,
79                 ::com::sun::star::io::IOException,
80                 ::com::sun::star::uno::RuntimeException );
81 
82     virtual sal_Int32 SAL_CALL available( void )
83             throw( ::com::sun::star::io::NotConnectedException,
84                 ::com::sun::star::io::IOException,
85                 ::com::sun::star::uno::RuntimeException );
86 
87     virtual void SAL_CALL closeInput( void )
88             throw( ::com::sun::star::io::NotConnectedException,
89                 ::com::sun::star::io::IOException,
90                 ::com::sun::star::uno::RuntimeException );
91 };
92 
93 } // namespace gio
94 #endif
95