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 _INPUSTREAM_HXX_
25 #define _INPUSTREAM_HXX_
26 
27 #include <rtl/ustring.hxx>
28 #include <osl/file.hxx>
29 #include <cppuhelper/weak.hxx>
30 #include <com/sun/star/uno/XInterface.hpp>
31 #include <com/sun/star/io/XSeekable.hpp>
32 #include <com/sun/star/io/XInputStream.hpp>
33 #include <com/sun/star/ucb/XContentProvider.hpp>
34 
35 
36 namespace chelp {
37 
38 	// forward declaration
39 
40 	class XInputStream_impl
41 		: public cppu::OWeakObject,
42 		  public com::sun::star::io::XInputStream,
43 		  public com::sun::star::io::XSeekable
44 	{
45 	public:
46 
47 		XInputStream_impl( const rtl::OUString& aUncPath );
48 
49 		virtual ~XInputStream_impl();
50 
51 		/**
52 		 *  Returns an error code as given by filerror.hxx
53 		 */
54 
55 		bool SAL_CALL CtorSuccess();
56 
57 		virtual com::sun::star::uno::Any SAL_CALL
58 		queryInterface(
59 			const com::sun::star::uno::Type& rType )
60 			throw( com::sun::star::uno::RuntimeException);
61 
62 		virtual void SAL_CALL
63 		acquire(
64 			void )
65 			throw();
66 
67 		virtual void SAL_CALL
68 		release(
69 			void )
70 			throw();
71 
72 		virtual sal_Int32 SAL_CALL
73 		readBytes(
74 			com::sun::star::uno::Sequence< sal_Int8 >& aData,
75 			sal_Int32 nBytesToRead )
76 			throw( com::sun::star::io::NotConnectedException,
77 				   com::sun::star::io::BufferSizeExceededException,
78 				   com::sun::star::io::IOException,
79 				   com::sun::star::uno::RuntimeException);
80 
81 		virtual sal_Int32 SAL_CALL
82 		readSomeBytes(
83 			com::sun::star::uno::Sequence< sal_Int8 >& aData,
84 			sal_Int32 nMaxBytesToRead )
85 			throw( com::sun::star::io::NotConnectedException,
86 				   com::sun::star::io::BufferSizeExceededException,
87 				   com::sun::star::io::IOException,
88 				   com::sun::star::uno::RuntimeException);
89 
90 		virtual void SAL_CALL
91 		skipBytes(
92 			sal_Int32 nBytesToSkip )
93 			throw( com::sun::star::io::NotConnectedException,
94 				   com::sun::star::io::BufferSizeExceededException,
95 				   com::sun::star::io::IOException,
96 				   com::sun::star::uno::RuntimeException );
97 
98 		virtual sal_Int32 SAL_CALL
99 		available(
100 			void )
101 			throw( com::sun::star::io::NotConnectedException,
102 				   com::sun::star::io::IOException,
103 				   com::sun::star::uno::RuntimeException );
104 
105 		virtual void SAL_CALL
106 		closeInput(
107 			void )
108 			throw( com::sun::star::io::NotConnectedException,
109 				   com::sun::star::io::IOException,
110 				   com::sun::star::uno::RuntimeException );
111 
112 		virtual void SAL_CALL
113 		seek(
114 			sal_Int64 location )
115 			throw( com::sun::star::lang::IllegalArgumentException,
116 				   com::sun::star::io::IOException,
117 				   com::sun::star::uno::RuntimeException );
118 
119 		virtual sal_Int64 SAL_CALL
120 		getPosition(
121 			void )
122 			throw( com::sun::star::io::IOException,
123 				   com::sun::star::uno::RuntimeException );
124 
125 		virtual sal_Int64 SAL_CALL
126 		getLength(
127 			void )
128 			throw( com::sun::star::io::IOException,
129 				   com::sun::star::uno::RuntimeException );
130 
131 	private:
132 
133         bool                                               m_bIsOpen;
134 		osl::File                                          m_aFile;
135 	};
136 
137 
138 } // end namespace XInputStream_impl
139 
140 #endif
141