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 75 virtual sal_Int32 SAL_CALL 76 readSomeBytes(css::uno::Sequence< sal_Int8 >& aData, 77 sal_Int32 nMaxBytesToRead ); 78 79 virtual void SAL_CALL 80 skipBytes(sal_Int32 nBytesToSkip); 81 82 virtual sal_Int32 SAL_CALL 83 available(void); 84 85 virtual void SAL_CALL 86 closeInput(void); 87 88 89 /** XSeekable 90 */ 91 92 virtual void SAL_CALL 93 seek(sal_Int64 location); 94 95 96 virtual sal_Int64 SAL_CALL 97 getPosition(void); 98 99 100 virtual sal_Int64 SAL_CALL 101 getLength(void); 102 103 // additional 104 105 // void append(const void* pBuffer,size_t size,size_t nmemb); 106 107 private: 108 oslFileHandle m_tmpfl; 109 sal_uInt64 m_nLength; 110 }; 111 112 113 } 114 115 #endif 116