Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*************************************************************************
3 : *
4 : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : *
6 : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : *
8 : * OpenOffice.org - a multi-platform office productivity suite
9 : *
10 : * This file is part of OpenOffice.org.
11 : *
12 : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : * it under the terms of the GNU Lesser General Public License version 3
14 : * only, as published by the Free Software Foundation.
15 : *
16 : * OpenOffice.org is distributed in the hope that it will be useful,
17 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : * GNU Lesser General Public License version 3 for more details
20 : * (a copy is included in the LICENSE file that accompanied this code).
21 : *
22 : * You should have received a copy of the GNU Lesser General Public License
23 : * version 3 along with OpenOffice.org. If not, see
24 : * <http://www.openoffice.org/license.html>
25 : * for a copy of the LGPLv3 License.
26 : *
27 : ************************************************************************/
28 : #ifndef _NEONINPUTSTREAM_HXX_
29 : #define _NEONINPUTSTREAM_HXX_
30 :
31 : #include <sal/types.h>
32 : #include <rtl/ustring.hxx>
33 : #include <cppuhelper/weak.hxx>
34 : #include <com/sun/star/io/XInputStream.hpp>
35 : #include <com/sun/star/io/XSeekable.hpp>
36 :
37 :
38 : namespace webdav_ucp
39 : {
40 :
41 : // -------------------------------------------------------------------
42 : // NeonInputStream
43 : // A simple XInputStream implementation provided specifically for use
44 : // by the DAVSession::GET method.
45 : // -------------------------------------------------------------------
46 : class NeonInputStream : public ::com::sun::star::io::XInputStream,
47 : public ::com::sun::star::io::XSeekable,
48 : public ::cppu::OWeakObject
49 : {
50 : private:
51 : com::sun::star::uno::Sequence< sal_Int8 > mInputBuffer;
52 : sal_Int64 mLen;
53 : sal_Int64 mPos;
54 :
55 : public:
56 : NeonInputStream( void );
57 : virtual ~NeonInputStream();
58 :
59 : // Add some data to the end of the stream
60 : void AddToStream( const char * inBuf, sal_Int32 inLen );
61 :
62 : // XInterface
63 : virtual com::sun::star::uno::Any SAL_CALL queryInterface(
64 : const ::com::sun::star::uno::Type & type )
65 : throw( ::com::sun::star::uno::RuntimeException );
66 :
67 0 : virtual void SAL_CALL acquire( void )
68 : throw ()
69 0 : { OWeakObject::acquire(); }
70 :
71 0 : virtual void SAL_CALL release( void )
72 : throw()
73 0 : { OWeakObject::release(); }
74 :
75 :
76 : // XInputStream
77 : virtual sal_Int32 SAL_CALL readBytes(
78 : ::com::sun::star::uno::Sequence< sal_Int8 > & aData,
79 : sal_Int32 nBytesToRead )
80 : throw( ::com::sun::star::io::NotConnectedException,
81 : ::com::sun::star::io::BufferSizeExceededException,
82 : ::com::sun::star::io::IOException,
83 : ::com::sun::star::uno::RuntimeException );
84 :
85 : virtual sal_Int32 SAL_CALL readSomeBytes(
86 : ::com::sun::star::uno::Sequence< sal_Int8 > & aData,
87 : sal_Int32 nMaxBytesToRead )
88 : throw( ::com::sun::star::io::NotConnectedException,
89 : ::com::sun::star::io::BufferSizeExceededException,
90 : ::com::sun::star::io::IOException,
91 : ::com::sun::star::uno::RuntimeException );
92 :
93 : virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
94 : throw( ::com::sun::star::io::NotConnectedException,
95 : ::com::sun::star::io::BufferSizeExceededException,
96 : ::com::sun::star::io::IOException,
97 : ::com::sun::star::uno::RuntimeException );
98 :
99 : virtual sal_Int32 SAL_CALL available( void )
100 : throw( ::com::sun::star::io::NotConnectedException,
101 : ::com::sun::star::io::IOException,
102 : ::com::sun::star::uno::RuntimeException );
103 :
104 : virtual void SAL_CALL closeInput( void )
105 : throw( ::com::sun::star::io::NotConnectedException,
106 : ::com::sun::star::io::IOException,
107 : ::com::sun::star::uno::RuntimeException );
108 :
109 : // XSeekable
110 : virtual void SAL_CALL seek( sal_Int64 location )
111 : throw( ::com::sun::star::lang::IllegalArgumentException,
112 : ::com::sun::star::io::IOException,
113 : ::com::sun::star::uno::RuntimeException );
114 :
115 : virtual sal_Int64 SAL_CALL getPosition()
116 : throw( ::com::sun::star::io::IOException,
117 : ::com::sun::star::uno::RuntimeException );
118 :
119 : virtual sal_Int64 SAL_CALL getLength()
120 : throw( ::com::sun::star::io::IOException,
121 : ::com::sun::star::uno::RuntimeException );
122 : };
123 :
124 : } // namespace webdav_ucp
125 : #endif // _NEONINPUTSTREAM_HXX_
126 :
127 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|