16df1ea1fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 36df1ea1fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 46df1ea1fSAndrew Rist * or more contributor license agreements. See the NOTICE file 56df1ea1fSAndrew Rist * distributed with this work for additional information 66df1ea1fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 76df1ea1fSAndrew Rist * to you under the Apache License, Version 2.0 (the 86df1ea1fSAndrew Rist * "License"); you may not use this file except in compliance 96df1ea1fSAndrew Rist * with the License. You may obtain a copy of the License at 106df1ea1fSAndrew Rist * 116df1ea1fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 126df1ea1fSAndrew Rist * 136df1ea1fSAndrew Rist * Unless required by applicable law or agreed to in writing, 146df1ea1fSAndrew Rist * software distributed under the License is distributed on an 156df1ea1fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 166df1ea1fSAndrew Rist * KIND, either express or implied. See the License for the 176df1ea1fSAndrew Rist * specific language governing permissions and limitations 186df1ea1fSAndrew Rist * under the License. 196df1ea1fSAndrew Rist * 206df1ea1fSAndrew Rist *************************************************************/ 216df1ea1fSAndrew Rist 226df1ea1fSAndrew 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> 36*72cd26ddSAriel Constenla-Haile #include <osl/file.h> 37cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp> 38cdf0e10cSrcweir #include <com/sun/star/io/XSeekable.hpp> 39*72cd26ddSAriel Constenla-Haile #include <cppuhelper/implbase2.hxx> 40*72cd26ddSAriel Constenla-Haile #include <cppuhelper/basemutex.hxx> 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 53*72cd26ddSAriel Constenla-Haile typedef ::cppu::WeakImplHelper2< 54*72cd26ddSAriel Constenla-Haile com::sun::star::io::XInputStream, 55*72cd26ddSAriel Constenla-Haile com::sun::star::io::XSeekable > FTPInputStream_Base; 56*72cd26ddSAriel Constenla-Haile 57cdf0e10cSrcweir class FTPInputStream 58*72cd26ddSAriel Constenla-Haile : protected cppu::BaseMutex, 59*72cd26ddSAriel Constenla-Haile public FTPInputStream_Base 60cdf0e10cSrcweir { 61cdf0e10cSrcweir public: 62cdf0e10cSrcweir 63cdf0e10cSrcweir /** Defines the storage kind found 64cdf0e10cSrcweir * on which the inputstream acts. 65cdf0e10cSrcweir */ 66cdf0e10cSrcweir 67*72cd26ddSAriel Constenla-Haile FTPInputStream(oslFileHandle tmpfl = 0); 68cdf0e10cSrcweir 69cdf0e10cSrcweir ~FTPInputStream(); 70cdf0e10cSrcweir 71cdf0e10cSrcweir virtual sal_Int32 SAL_CALL 72cdf0e10cSrcweir readBytes(css::uno::Sequence< sal_Int8 >& aData, 73cdf0e10cSrcweir sal_Int32 nBytesToRead) 74cdf0e10cSrcweir throw( css::io::NotConnectedException, 75cdf0e10cSrcweir css::io::BufferSizeExceededException, 76cdf0e10cSrcweir css::io::IOException, 77cdf0e10cSrcweir css::uno::RuntimeException); 78cdf0e10cSrcweir 79cdf0e10cSrcweir virtual sal_Int32 SAL_CALL 80cdf0e10cSrcweir readSomeBytes(css::uno::Sequence< sal_Int8 >& aData, 81cdf0e10cSrcweir sal_Int32 nMaxBytesToRead ) 82cdf0e10cSrcweir throw( css::io::NotConnectedException, 83cdf0e10cSrcweir css::io::BufferSizeExceededException, 84cdf0e10cSrcweir css::io::IOException, 85cdf0e10cSrcweir css::uno::RuntimeException); 86cdf0e10cSrcweir 87cdf0e10cSrcweir virtual void SAL_CALL 88cdf0e10cSrcweir skipBytes(sal_Int32 nBytesToSkip) 89cdf0e10cSrcweir throw(css::io::NotConnectedException, 90cdf0e10cSrcweir css::io::BufferSizeExceededException, 91cdf0e10cSrcweir css::io::IOException, 92cdf0e10cSrcweir css::uno::RuntimeException ); 93cdf0e10cSrcweir 94cdf0e10cSrcweir virtual sal_Int32 SAL_CALL 95cdf0e10cSrcweir available(void) 96cdf0e10cSrcweir throw(css::io::NotConnectedException, 97cdf0e10cSrcweir css::io::IOException, 98cdf0e10cSrcweir css::uno::RuntimeException ); 99cdf0e10cSrcweir 100cdf0e10cSrcweir virtual void SAL_CALL 101cdf0e10cSrcweir closeInput(void) 102cdf0e10cSrcweir throw(css::io::NotConnectedException, 103cdf0e10cSrcweir css::io::IOException, 104cdf0e10cSrcweir css::uno::RuntimeException); 105cdf0e10cSrcweir 106cdf0e10cSrcweir 107cdf0e10cSrcweir /** XSeekable 108cdf0e10cSrcweir */ 109cdf0e10cSrcweir 110cdf0e10cSrcweir virtual void SAL_CALL 111cdf0e10cSrcweir seek(sal_Int64 location) 112cdf0e10cSrcweir throw(css::lang::IllegalArgumentException, 113cdf0e10cSrcweir css::io::IOException, 114cdf0e10cSrcweir css::uno::RuntimeException); 115cdf0e10cSrcweir 116cdf0e10cSrcweir 117cdf0e10cSrcweir virtual sal_Int64 SAL_CALL 118cdf0e10cSrcweir getPosition(void) 119cdf0e10cSrcweir throw(css::io::IOException, 120cdf0e10cSrcweir css::uno::RuntimeException); 121cdf0e10cSrcweir 122cdf0e10cSrcweir 123cdf0e10cSrcweir virtual sal_Int64 SAL_CALL 124cdf0e10cSrcweir getLength(void) 125cdf0e10cSrcweir throw(css::io::IOException, 126cdf0e10cSrcweir css::uno::RuntimeException); 127cdf0e10cSrcweir 128cdf0e10cSrcweir // additional 129cdf0e10cSrcweir 130cdf0e10cSrcweir // void append(const void* pBuffer,size_t size,size_t nmemb); 131cdf0e10cSrcweir 132cdf0e10cSrcweir private: 133*72cd26ddSAriel Constenla-Haile oslFileHandle m_tmpfl; 134*72cd26ddSAriel Constenla-Haile sal_uInt64 m_nLength; 135cdf0e10cSrcweir }; 136cdf0e10cSrcweir 137cdf0e10cSrcweir 138cdf0e10cSrcweir } 139cdf0e10cSrcweir 140cdf0e10cSrcweir #endif 141