xref: /AOO41X/main/ucb/source/ucp/webdav/SerfInputStream.hxx (revision 8590a0fdd306f78ee72b863c64cbcf09c28509eb)
1*8590a0fdSAndre Fischer /**************************************************************
2*8590a0fdSAndre Fischer  *
3*8590a0fdSAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
4*8590a0fdSAndre Fischer  * or more contributor license agreements.  See the NOTICE file
5*8590a0fdSAndre Fischer  * distributed with this work for additional information
6*8590a0fdSAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
7*8590a0fdSAndre Fischer  * to you under the Apache License, Version 2.0 (the
8*8590a0fdSAndre Fischer  * "License"); you may not use this file except in compliance
9*8590a0fdSAndre Fischer  * with the License.  You may obtain a copy of the License at
10*8590a0fdSAndre Fischer  *
11*8590a0fdSAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
12*8590a0fdSAndre Fischer  *
13*8590a0fdSAndre Fischer  * Unless required by applicable law or agreed to in writing,
14*8590a0fdSAndre Fischer  * software distributed under the License is distributed on an
15*8590a0fdSAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*8590a0fdSAndre Fischer  * KIND, either express or implied.  See the License for the
17*8590a0fdSAndre Fischer  * specific language governing permissions and limitations
18*8590a0fdSAndre Fischer  * under the License.
19*8590a0fdSAndre Fischer  *
20*8590a0fdSAndre Fischer  *************************************************************/
21*8590a0fdSAndre Fischer 
22*8590a0fdSAndre Fischer 
23*8590a0fdSAndre Fischer #ifndef INCLUDED_NEONINPUTSTREAM_HXX
24*8590a0fdSAndre Fischer #define INCLUDED_NEONINPUTSTREAM_HXX
25*8590a0fdSAndre Fischer 
26*8590a0fdSAndre Fischer #include <sal/types.h>
27*8590a0fdSAndre Fischer #include <rtl/ustring.hxx>
28*8590a0fdSAndre Fischer #include <cppuhelper/weak.hxx>
29*8590a0fdSAndre Fischer #include <com/sun/star/io/XInputStream.hpp>
30*8590a0fdSAndre Fischer #include <com/sun/star/io/XSeekable.hpp>
31*8590a0fdSAndre Fischer 
32*8590a0fdSAndre Fischer 
33*8590a0fdSAndre Fischer namespace http_dav_ucp
34*8590a0fdSAndre Fischer {
35*8590a0fdSAndre Fischer 
36*8590a0fdSAndre Fischer // -------------------------------------------------------------------
37*8590a0fdSAndre Fischer // SerfInputStream
38*8590a0fdSAndre Fischer // A simple XInputStream implementation provided specifically for use
39*8590a0fdSAndre Fischer // by the DAVSession::GET method.
40*8590a0fdSAndre Fischer // -------------------------------------------------------------------
41*8590a0fdSAndre Fischer class SerfInputStream : public ::com::sun::star::io::XInputStream,
42*8590a0fdSAndre Fischer 						public ::com::sun::star::io::XSeekable,
43*8590a0fdSAndre Fischer 						public ::cppu::OWeakObject
44*8590a0fdSAndre Fischer {
45*8590a0fdSAndre Fischer 	private:
46*8590a0fdSAndre Fischer 		com::sun::star::uno::Sequence< sal_Int8 > mInputBuffer;
47*8590a0fdSAndre Fischer 		sal_Int64 mLen;
48*8590a0fdSAndre Fischer 		sal_Int64 mPos;
49*8590a0fdSAndre Fischer 
50*8590a0fdSAndre Fischer 	public:
51*8590a0fdSAndre Fischer 				 SerfInputStream( void );
52*8590a0fdSAndre Fischer 		virtual ~SerfInputStream();
53*8590a0fdSAndre Fischer 
54*8590a0fdSAndre Fischer 		// Add some data to the end of the stream
55*8590a0fdSAndre Fischer 		void AddToStream( const char * inBuf, sal_Int32 inLen );
56*8590a0fdSAndre Fischer 
57*8590a0fdSAndre Fischer 	// XInterface
58*8590a0fdSAndre Fischer 	virtual com::sun::star::uno::Any SAL_CALL queryInterface(
59*8590a0fdSAndre Fischer 										const ::com::sun::star::uno::Type & type )
60*8590a0fdSAndre Fischer 							throw( ::com::sun::star::uno::RuntimeException );
61*8590a0fdSAndre Fischer 
acquire(void)62*8590a0fdSAndre Fischer 	virtual void SAL_CALL acquire( void )
63*8590a0fdSAndre Fischer 							throw ()
64*8590a0fdSAndre Fischer 								{ OWeakObject::acquire(); }
65*8590a0fdSAndre Fischer 
release(void)66*8590a0fdSAndre Fischer 	virtual void SAL_CALL release( void )
67*8590a0fdSAndre Fischer 							throw()
68*8590a0fdSAndre Fischer 								{ OWeakObject::release(); }
69*8590a0fdSAndre Fischer 
70*8590a0fdSAndre Fischer 
71*8590a0fdSAndre Fischer 	// XInputStream
72*8590a0fdSAndre Fischer 	virtual sal_Int32 SAL_CALL readBytes(
73*8590a0fdSAndre Fischer 	  		::com::sun::star::uno::Sequence< sal_Int8 > & aData,
74*8590a0fdSAndre Fischer 			sal_Int32 nBytesToRead )
75*8590a0fdSAndre Fischer 				throw( ::com::sun::star::io::NotConnectedException,
76*8590a0fdSAndre Fischer 			   		   ::com::sun::star::io::BufferSizeExceededException,
77*8590a0fdSAndre Fischer 			   		   ::com::sun::star::io::IOException,
78*8590a0fdSAndre Fischer 			   		   ::com::sun::star::uno::RuntimeException );
79*8590a0fdSAndre Fischer 
80*8590a0fdSAndre Fischer 	virtual sal_Int32 SAL_CALL readSomeBytes(
81*8590a0fdSAndre Fischer     		::com::sun::star::uno::Sequence< sal_Int8 > & aData,
82*8590a0fdSAndre Fischer 			sal_Int32 nMaxBytesToRead )
83*8590a0fdSAndre Fischer         		throw( ::com::sun::star::io::NotConnectedException,
84*8590a0fdSAndre Fischer                		   ::com::sun::star::io::BufferSizeExceededException,
85*8590a0fdSAndre Fischer                		   ::com::sun::star::io::IOException,
86*8590a0fdSAndre Fischer                		   ::com::sun::star::uno::RuntimeException );
87*8590a0fdSAndre Fischer 
88*8590a0fdSAndre Fischer 	virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
89*8590a0fdSAndre Fischer         		throw( ::com::sun::star::io::NotConnectedException,
90*8590a0fdSAndre Fischer                		   ::com::sun::star::io::BufferSizeExceededException,
91*8590a0fdSAndre Fischer                		   ::com::sun::star::io::IOException,
92*8590a0fdSAndre Fischer                		   ::com::sun::star::uno::RuntimeException );
93*8590a0fdSAndre Fischer 
94*8590a0fdSAndre Fischer 	virtual sal_Int32 SAL_CALL available( void )
95*8590a0fdSAndre Fischer         		throw( ::com::sun::star::io::NotConnectedException,
96*8590a0fdSAndre Fischer                		   ::com::sun::star::io::IOException,
97*8590a0fdSAndre Fischer                		   ::com::sun::star::uno::RuntimeException );
98*8590a0fdSAndre Fischer 
99*8590a0fdSAndre Fischer 	virtual void SAL_CALL closeInput( void )
100*8590a0fdSAndre Fischer         		throw( ::com::sun::star::io::NotConnectedException,
101*8590a0fdSAndre Fischer                		   ::com::sun::star::io::IOException,
102*8590a0fdSAndre Fischer                		   ::com::sun::star::uno::RuntimeException );
103*8590a0fdSAndre Fischer 
104*8590a0fdSAndre Fischer 	// XSeekable
105*8590a0fdSAndre Fischer 	virtual void SAL_CALL seek(	sal_Int64 location )
106*8590a0fdSAndre Fischer 		throw( ::com::sun::star::lang::IllegalArgumentException,
107*8590a0fdSAndre Fischer 			   ::com::sun::star::io::IOException,
108*8590a0fdSAndre Fischer 			   ::com::sun::star::uno::RuntimeException );
109*8590a0fdSAndre Fischer 
110*8590a0fdSAndre Fischer 	virtual sal_Int64 SAL_CALL getPosition()
111*8590a0fdSAndre Fischer 		throw( ::com::sun::star::io::IOException,
112*8590a0fdSAndre Fischer 			   ::com::sun::star::uno::RuntimeException );
113*8590a0fdSAndre Fischer 
114*8590a0fdSAndre Fischer 	virtual sal_Int64 SAL_CALL getLength()
115*8590a0fdSAndre Fischer 		throw( ::com::sun::star::io::IOException,
116*8590a0fdSAndre Fischer 			   ::com::sun::star::uno::RuntimeException );
117*8590a0fdSAndre Fischer };
118*8590a0fdSAndre Fischer 
119*8590a0fdSAndre Fischer } // namespace http_dav_ucp
120*8590a0fdSAndre Fischer 
121*8590a0fdSAndre Fischer #endif // INCLUDED_NEONINPUTSTREAM_HXX
122