xref: /aoo41x/main/ucb/source/ucp/ftp/ftpinpstr.hxx (revision 6df1ea1f)
1*6df1ea1fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*6df1ea1fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*6df1ea1fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*6df1ea1fSAndrew Rist  * distributed with this work for additional information
6*6df1ea1fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*6df1ea1fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*6df1ea1fSAndrew Rist  * "License"); you may not use this file except in compliance
9*6df1ea1fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*6df1ea1fSAndrew Rist  *
11*6df1ea1fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*6df1ea1fSAndrew Rist  *
13*6df1ea1fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*6df1ea1fSAndrew Rist  * software distributed under the License is distributed on an
15*6df1ea1fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*6df1ea1fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*6df1ea1fSAndrew Rist  * specific language governing permissions and limitations
18*6df1ea1fSAndrew Rist  * under the License.
19*6df1ea1fSAndrew Rist  *
20*6df1ea1fSAndrew Rist  *************************************************************/
21*6df1ea1fSAndrew Rist 
22*6df1ea1fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir /**************************************************************************
25cdf0e10cSrcweir 								TODO
26cdf0e10cSrcweir  **************************************************************************
27cdf0e10cSrcweir 
28cdf0e10cSrcweir  *************************************************************************/
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #ifndef _FTP_FTPINPSTR_HXX_
31cdf0e10cSrcweir #define _FTP_FTPINPSTR_HXX_
32cdf0e10cSrcweir 
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include <rtl/ustring.hxx>
35cdf0e10cSrcweir #include <osl/mutex.hxx>
36cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
37cdf0e10cSrcweir #include <cppuhelper/queryinterface.hxx>
38cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp>
39cdf0e10cSrcweir #include <com/sun/star/io/XSeekable.hpp>
40cdf0e10cSrcweir #include <stdio.h>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 
43cdf0e10cSrcweir namespace ftp {
44cdf0e10cSrcweir 
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 	/** Implements a seekable InputStream
47cdf0e10cSrcweir 	 *  working on a buffer.
48cdf0e10cSrcweir 	 */
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 	namespace css = com::sun::star;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 	class FTPInputStream
55cdf0e10cSrcweir 		: public cppu::OWeakObject,
56cdf0e10cSrcweir 		  public com::sun::star::io::XInputStream,
57cdf0e10cSrcweir 		  public com::sun::star::io::XSeekable
58cdf0e10cSrcweir 	{
59cdf0e10cSrcweir 	public:
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 		/** Defines the storage kind found
62cdf0e10cSrcweir 		 *  on which the inputstream acts.
63cdf0e10cSrcweir 		 */
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 		FTPInputStream(FILE* tmpfl = 0);
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 		~FTPInputStream();
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 		virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& rType)
70cdf0e10cSrcweir 			throw(css::uno::RuntimeException);
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 		virtual void SAL_CALL acquire(void) throw();
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 		virtual void SAL_CALL release(void) throw();
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL
77cdf0e10cSrcweir 		readBytes(css::uno::Sequence< sal_Int8 >& aData,
78cdf0e10cSrcweir 				  sal_Int32 nBytesToRead)
79cdf0e10cSrcweir 			throw( css::io::NotConnectedException,
80cdf0e10cSrcweir 				   css::io::BufferSizeExceededException,
81cdf0e10cSrcweir 				   css::io::IOException,
82cdf0e10cSrcweir 				   css::uno::RuntimeException);
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL
85cdf0e10cSrcweir 		readSomeBytes(css::uno::Sequence< sal_Int8 >& aData,
86cdf0e10cSrcweir 					  sal_Int32 nMaxBytesToRead )
87cdf0e10cSrcweir 			throw( css::io::NotConnectedException,
88cdf0e10cSrcweir 				   css::io::BufferSizeExceededException,
89cdf0e10cSrcweir 				   css::io::IOException,
90cdf0e10cSrcweir 				   css::uno::RuntimeException);
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 		virtual void SAL_CALL
93cdf0e10cSrcweir 		skipBytes(sal_Int32 nBytesToSkip)
94cdf0e10cSrcweir 			throw(css::io::NotConnectedException,
95cdf0e10cSrcweir 				  css::io::BufferSizeExceededException,
96cdf0e10cSrcweir 				  css::io::IOException,
97cdf0e10cSrcweir 				  css::uno::RuntimeException );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL
100cdf0e10cSrcweir 		available(void)
101cdf0e10cSrcweir 			throw(css::io::NotConnectedException,
102cdf0e10cSrcweir 				  css::io::IOException,
103cdf0e10cSrcweir 				  css::uno::RuntimeException );
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 		virtual void SAL_CALL
106cdf0e10cSrcweir 		closeInput(void)
107cdf0e10cSrcweir 			throw(css::io::NotConnectedException,
108cdf0e10cSrcweir 				  css::io::IOException,
109cdf0e10cSrcweir 				  css::uno::RuntimeException);
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 		/** XSeekable
113cdf0e10cSrcweir 		 */
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 		virtual void SAL_CALL
116cdf0e10cSrcweir 		seek(sal_Int64 location)
117cdf0e10cSrcweir 			throw(css::lang::IllegalArgumentException,
118cdf0e10cSrcweir 				  css::io::IOException,
119cdf0e10cSrcweir 				  css::uno::RuntimeException);
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 		virtual sal_Int64 SAL_CALL
123cdf0e10cSrcweir 		getPosition(void)
124cdf0e10cSrcweir 			throw(css::io::IOException,
125cdf0e10cSrcweir 				  css::uno::RuntimeException);
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 		virtual sal_Int64 SAL_CALL
129cdf0e10cSrcweir 		getLength(void)
130cdf0e10cSrcweir 			throw(css::io::IOException,
131cdf0e10cSrcweir 				  css::uno::RuntimeException);
132cdf0e10cSrcweir 
133cdf0e10cSrcweir         // additional
134cdf0e10cSrcweir 
135cdf0e10cSrcweir //          void append(const void* pBuffer,size_t size,size_t nmemb);
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 	private:
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 		osl::Mutex m_aMutex;
140cdf0e10cSrcweir 		FILE* m_tmpfl;
141cdf0e10cSrcweir 		sal_Int64 m_nLength;
142cdf0e10cSrcweir 	};
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 
145cdf0e10cSrcweir }
146cdf0e10cSrcweir 
147cdf0e10cSrcweir #endif
148