xref: /aoo42x/main/ucb/source/ucp/ftp/ftpinpstr.hxx (revision 6df1ea1f)
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 /**************************************************************************
25 								TODO
26  **************************************************************************
27 
28  *************************************************************************/
29 
30 #ifndef _FTP_FTPINPSTR_HXX_
31 #define _FTP_FTPINPSTR_HXX_
32 
33 
34 #include <rtl/ustring.hxx>
35 #include <osl/mutex.hxx>
36 #include <cppuhelper/weak.hxx>
37 #include <cppuhelper/queryinterface.hxx>
38 #include <com/sun/star/io/XInputStream.hpp>
39 #include <com/sun/star/io/XSeekable.hpp>
40 #include <stdio.h>
41 
42 
43 namespace ftp {
44 
45 
46 	/** Implements a seekable InputStream
47 	 *  working on a buffer.
48 	 */
49 
50 
51 	namespace css = com::sun::star;
52 
53 
54 	class FTPInputStream
55 		: public cppu::OWeakObject,
56 		  public com::sun::star::io::XInputStream,
57 		  public com::sun::star::io::XSeekable
58 	{
59 	public:
60 
61 		/** Defines the storage kind found
62 		 *  on which the inputstream acts.
63 		 */
64 
65 		FTPInputStream(FILE* tmpfl = 0);
66 
67 		~FTPInputStream();
68 
69 		virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& rType)
70 			throw(css::uno::RuntimeException);
71 
72 		virtual void SAL_CALL acquire(void) throw();
73 
74 		virtual void SAL_CALL release(void) throw();
75 
76 		virtual sal_Int32 SAL_CALL
77 		readBytes(css::uno::Sequence< sal_Int8 >& aData,
78 				  sal_Int32 nBytesToRead)
79 			throw( css::io::NotConnectedException,
80 				   css::io::BufferSizeExceededException,
81 				   css::io::IOException,
82 				   css::uno::RuntimeException);
83 
84 		virtual sal_Int32 SAL_CALL
85 		readSomeBytes(css::uno::Sequence< sal_Int8 >& aData,
86 					  sal_Int32 nMaxBytesToRead )
87 			throw( css::io::NotConnectedException,
88 				   css::io::BufferSizeExceededException,
89 				   css::io::IOException,
90 				   css::uno::RuntimeException);
91 
92 		virtual void SAL_CALL
93 		skipBytes(sal_Int32 nBytesToSkip)
94 			throw(css::io::NotConnectedException,
95 				  css::io::BufferSizeExceededException,
96 				  css::io::IOException,
97 				  css::uno::RuntimeException );
98 
99 		virtual sal_Int32 SAL_CALL
100 		available(void)
101 			throw(css::io::NotConnectedException,
102 				  css::io::IOException,
103 				  css::uno::RuntimeException );
104 
105 		virtual void SAL_CALL
106 		closeInput(void)
107 			throw(css::io::NotConnectedException,
108 				  css::io::IOException,
109 				  css::uno::RuntimeException);
110 
111 
112 		/** XSeekable
113 		 */
114 
115 		virtual void SAL_CALL
116 		seek(sal_Int64 location)
117 			throw(css::lang::IllegalArgumentException,
118 				  css::io::IOException,
119 				  css::uno::RuntimeException);
120 
121 
122 		virtual sal_Int64 SAL_CALL
123 		getPosition(void)
124 			throw(css::io::IOException,
125 				  css::uno::RuntimeException);
126 
127 
128 		virtual sal_Int64 SAL_CALL
129 		getLength(void)
130 			throw(css::io::IOException,
131 				  css::uno::RuntimeException);
132 
133         // additional
134 
135 //          void append(const void* pBuffer,size_t size,size_t nmemb);
136 
137 	private:
138 
139 		osl::Mutex m_aMutex;
140 		FILE* m_tmpfl;
141 		sal_Int64 m_nLength;
142 	};
143 
144 
145 }
146 
147 #endif
148