xref: /AOO41X/main/ucb/source/ucp/ftp/ftpinpstr.hxx (revision d3e0dd8eb215533c15e891ee35bd141abe9397ee)
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 <osl/file.h>
37 #include <com/sun/star/io/XInputStream.hpp>
38 #include <com/sun/star/io/XSeekable.hpp>
39 #include <cppuhelper/implbase2.hxx>
40 #include <cppuhelper/basemutex.hxx>
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     typedef ::cppu::WeakImplHelper2<
54         com::sun::star::io::XInputStream,
55         com::sun::star::io::XSeekable > FTPInputStream_Base;
56 
57     class FTPInputStream
58         : protected cppu::BaseMutex,
59           public FTPInputStream_Base
60     {
61     public:
62 
63         /** Defines the storage kind found
64          *  on which the inputstream acts.
65          */
66 
67         FTPInputStream(oslFileHandle tmpfl = 0);
68 
69         ~FTPInputStream();
70 
71         virtual sal_Int32 SAL_CALL
72         readBytes(css::uno::Sequence< sal_Int8 >& aData,
73                   sal_Int32 nBytesToRead)
74             throw( css::io::NotConnectedException,
75                    css::io::BufferSizeExceededException,
76                    css::io::IOException,
77                    css::uno::RuntimeException);
78 
79         virtual sal_Int32 SAL_CALL
80         readSomeBytes(css::uno::Sequence< sal_Int8 >& aData,
81                       sal_Int32 nMaxBytesToRead )
82             throw( css::io::NotConnectedException,
83                    css::io::BufferSizeExceededException,
84                    css::io::IOException,
85                    css::uno::RuntimeException);
86 
87         virtual void SAL_CALL
88         skipBytes(sal_Int32 nBytesToSkip)
89             throw(css::io::NotConnectedException,
90                   css::io::BufferSizeExceededException,
91                   css::io::IOException,
92                   css::uno::RuntimeException );
93 
94         virtual sal_Int32 SAL_CALL
95         available(void)
96             throw(css::io::NotConnectedException,
97                   css::io::IOException,
98                   css::uno::RuntimeException );
99 
100         virtual void SAL_CALL
101         closeInput(void)
102             throw(css::io::NotConnectedException,
103                   css::io::IOException,
104                   css::uno::RuntimeException);
105 
106 
107         /** XSeekable
108          */
109 
110         virtual void SAL_CALL
111         seek(sal_Int64 location)
112             throw(css::lang::IllegalArgumentException,
113                   css::io::IOException,
114                   css::uno::RuntimeException);
115 
116 
117         virtual sal_Int64 SAL_CALL
118         getPosition(void)
119             throw(css::io::IOException,
120                   css::uno::RuntimeException);
121 
122 
123         virtual sal_Int64 SAL_CALL
124         getLength(void)
125             throw(css::io::IOException,
126                   css::uno::RuntimeException);
127 
128         // additional
129 
130 //          void append(const void* pBuffer,size_t size,size_t nmemb);
131 
132     private:
133         oslFileHandle m_tmpfl;
134         sal_uInt64 m_nLength;
135     };
136 
137 
138 }
139 
140 #endif
141