18590a0fdSAndre Fischer /************************************************************** 28590a0fdSAndre Fischer * 38590a0fdSAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 48590a0fdSAndre Fischer * or more contributor license agreements. See the NOTICE file 58590a0fdSAndre Fischer * distributed with this work for additional information 68590a0fdSAndre Fischer * regarding copyright ownership. The ASF licenses this file 78590a0fdSAndre Fischer * to you under the Apache License, Version 2.0 (the 88590a0fdSAndre Fischer * "License"); you may not use this file except in compliance 98590a0fdSAndre Fischer * with the License. You may obtain a copy of the License at 108590a0fdSAndre Fischer * 118590a0fdSAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 128590a0fdSAndre Fischer * 138590a0fdSAndre Fischer * Unless required by applicable law or agreed to in writing, 148590a0fdSAndre Fischer * software distributed under the License is distributed on an 158590a0fdSAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 168590a0fdSAndre Fischer * KIND, either express or implied. See the License for the 178590a0fdSAndre Fischer * specific language governing permissions and limitations 188590a0fdSAndre Fischer * under the License. 198590a0fdSAndre Fischer * 208590a0fdSAndre Fischer *************************************************************/ 218590a0fdSAndre Fischer 228590a0fdSAndre Fischer 23*9646dec5SDamjan Jovanovic #ifndef INCLUDED_CURLINPUTSTREAM_HXX 24*9646dec5SDamjan Jovanovic #define INCLUDED_CURLINPUTSTREAM_HXX 258590a0fdSAndre Fischer 268590a0fdSAndre Fischer #include <sal/types.h> 278590a0fdSAndre Fischer #include <rtl/ustring.hxx> 288590a0fdSAndre Fischer #include <cppuhelper/weak.hxx> 298590a0fdSAndre Fischer #include <com/sun/star/io/XInputStream.hpp> 308590a0fdSAndre Fischer #include <com/sun/star/io/XSeekable.hpp> 318590a0fdSAndre Fischer 328590a0fdSAndre Fischer 338590a0fdSAndre Fischer namespace http_dav_ucp 348590a0fdSAndre Fischer { 358590a0fdSAndre Fischer 368590a0fdSAndre Fischer // ------------------------------------------------------------------- 37*9646dec5SDamjan Jovanovic // CurlInputStream 388590a0fdSAndre Fischer // A simple XInputStream implementation provided specifically for use 398590a0fdSAndre Fischer // by the DAVSession::GET method. 408590a0fdSAndre Fischer // ------------------------------------------------------------------- 41*9646dec5SDamjan Jovanovic class CurlInputStream : public ::com::sun::star::io::XInputStream, 428590a0fdSAndre Fischer public ::com::sun::star::io::XSeekable, 438590a0fdSAndre Fischer public ::cppu::OWeakObject 448590a0fdSAndre Fischer { 458590a0fdSAndre Fischer private: 468590a0fdSAndre Fischer com::sun::star::uno::Sequence< sal_Int8 > mInputBuffer; 478590a0fdSAndre Fischer sal_Int64 mLen; 488590a0fdSAndre Fischer sal_Int64 mPos; 49*9646dec5SDamjan Jovanovic sal_Int64 mCapacity; 508590a0fdSAndre Fischer 518590a0fdSAndre Fischer public: 52*9646dec5SDamjan Jovanovic CurlInputStream( void ); 53*9646dec5SDamjan Jovanovic virtual ~CurlInputStream(); 548590a0fdSAndre Fischer 558590a0fdSAndre Fischer // Add some data to the end of the stream 568590a0fdSAndre Fischer void AddToStream( const char * inBuf, sal_Int32 inLen ); 578590a0fdSAndre Fischer 588590a0fdSAndre Fischer // XInterface 598590a0fdSAndre Fischer virtual com::sun::star::uno::Any SAL_CALL queryInterface( 608590a0fdSAndre Fischer const ::com::sun::star::uno::Type & type ) 618590a0fdSAndre Fischer throw( ::com::sun::star::uno::RuntimeException ); 628590a0fdSAndre Fischer acquire(void)638590a0fdSAndre Fischer virtual void SAL_CALL acquire( void ) 648590a0fdSAndre Fischer throw () 658590a0fdSAndre Fischer { OWeakObject::acquire(); } 668590a0fdSAndre Fischer release(void)678590a0fdSAndre Fischer virtual void SAL_CALL release( void ) 688590a0fdSAndre Fischer throw() 698590a0fdSAndre Fischer { OWeakObject::release(); } 708590a0fdSAndre Fischer 718590a0fdSAndre Fischer 728590a0fdSAndre Fischer // XInputStream 738590a0fdSAndre Fischer virtual sal_Int32 SAL_CALL readBytes( 748590a0fdSAndre Fischer ::com::sun::star::uno::Sequence< sal_Int8 > & aData, 758590a0fdSAndre Fischer sal_Int32 nBytesToRead ) 768590a0fdSAndre Fischer throw( ::com::sun::star::io::NotConnectedException, 778590a0fdSAndre Fischer ::com::sun::star::io::BufferSizeExceededException, 788590a0fdSAndre Fischer ::com::sun::star::io::IOException, 798590a0fdSAndre Fischer ::com::sun::star::uno::RuntimeException ); 808590a0fdSAndre Fischer 818590a0fdSAndre Fischer virtual sal_Int32 SAL_CALL readSomeBytes( 828590a0fdSAndre Fischer ::com::sun::star::uno::Sequence< sal_Int8 > & aData, 838590a0fdSAndre Fischer sal_Int32 nMaxBytesToRead ) 848590a0fdSAndre Fischer throw( ::com::sun::star::io::NotConnectedException, 858590a0fdSAndre Fischer ::com::sun::star::io::BufferSizeExceededException, 868590a0fdSAndre Fischer ::com::sun::star::io::IOException, 878590a0fdSAndre Fischer ::com::sun::star::uno::RuntimeException ); 888590a0fdSAndre Fischer 898590a0fdSAndre Fischer virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) 908590a0fdSAndre Fischer throw( ::com::sun::star::io::NotConnectedException, 918590a0fdSAndre Fischer ::com::sun::star::io::BufferSizeExceededException, 928590a0fdSAndre Fischer ::com::sun::star::io::IOException, 938590a0fdSAndre Fischer ::com::sun::star::uno::RuntimeException ); 948590a0fdSAndre Fischer 958590a0fdSAndre Fischer virtual sal_Int32 SAL_CALL available( void ) 968590a0fdSAndre Fischer throw( ::com::sun::star::io::NotConnectedException, 978590a0fdSAndre Fischer ::com::sun::star::io::IOException, 988590a0fdSAndre Fischer ::com::sun::star::uno::RuntimeException ); 998590a0fdSAndre Fischer 1008590a0fdSAndre Fischer virtual void SAL_CALL closeInput( void ) 1018590a0fdSAndre Fischer throw( ::com::sun::star::io::NotConnectedException, 1028590a0fdSAndre Fischer ::com::sun::star::io::IOException, 1038590a0fdSAndre Fischer ::com::sun::star::uno::RuntimeException ); 1048590a0fdSAndre Fischer 1058590a0fdSAndre Fischer // XSeekable 1068590a0fdSAndre Fischer virtual void SAL_CALL seek( sal_Int64 location ) 1078590a0fdSAndre Fischer throw( ::com::sun::star::lang::IllegalArgumentException, 1088590a0fdSAndre Fischer ::com::sun::star::io::IOException, 1098590a0fdSAndre Fischer ::com::sun::star::uno::RuntimeException ); 1108590a0fdSAndre Fischer 1118590a0fdSAndre Fischer virtual sal_Int64 SAL_CALL getPosition() 1128590a0fdSAndre Fischer throw( ::com::sun::star::io::IOException, 1138590a0fdSAndre Fischer ::com::sun::star::uno::RuntimeException ); 1148590a0fdSAndre Fischer 1158590a0fdSAndre Fischer virtual sal_Int64 SAL_CALL getLength() 1168590a0fdSAndre Fischer throw( ::com::sun::star::io::IOException, 1178590a0fdSAndre Fischer ::com::sun::star::uno::RuntimeException ); 1188590a0fdSAndre Fischer }; 1198590a0fdSAndre Fischer 1208590a0fdSAndre Fischer } // namespace http_dav_ucp 1218590a0fdSAndre Fischer 122*9646dec5SDamjan Jovanovic #endif // INCLUDED_CURLINPUTSTREAM_HXX 123