1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_SERFINPUTSTREAM_HXX
22 #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_SERFINPUTSTREAM_HXX
24 #include <sal/types.h>
25 #include <rtl/ustring.hxx>
26 #include <cppuhelper/weak.hxx>
27 #include <com/sun/star/io/XInputStream.hpp>
28 #include <com/sun/star/io/XSeekable.hpp>
31 namespace http_dav_ucp
36 // A simple XInputStream implementation provided specifically for use
37 // by the DAVSession::GET method.
39 class SerfInputStream
: public ::com::sun::star::io::XInputStream
,
40 public ::com::sun::star::io::XSeekable
,
41 public ::cppu::OWeakObject
44 com::sun::star::uno::Sequence
< sal_Int8
> mInputBuffer
;
50 virtual ~SerfInputStream();
52 // Add some data to the end of the stream
53 void AddToStream( const char * inBuf
, sal_Int32 inLen
);
56 virtual com::sun::star::uno::Any SAL_CALL
queryInterface(
57 const ::com::sun::star::uno::Type
& type
)
58 throw( ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
60 virtual void SAL_CALL
acquire()
62 { OWeakObject::acquire(); }
64 virtual void SAL_CALL
release()
66 { OWeakObject::release(); }
70 virtual sal_Int32 SAL_CALL
readBytes(
71 ::com::sun::star::uno::Sequence
< sal_Int8
> & aData
,
72 sal_Int32 nBytesToRead
)
73 throw( ::com::sun::star::io::NotConnectedException
,
74 ::com::sun::star::io::BufferSizeExceededException
,
75 ::com::sun::star::io::IOException
,
76 ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
78 virtual sal_Int32 SAL_CALL
readSomeBytes(
79 ::com::sun::star::uno::Sequence
< sal_Int8
> & aData
,
80 sal_Int32 nMaxBytesToRead
)
81 throw( ::com::sun::star::io::NotConnectedException
,
82 ::com::sun::star::io::BufferSizeExceededException
,
83 ::com::sun::star::io::IOException
,
84 ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
86 virtual void SAL_CALL
skipBytes( sal_Int32 nBytesToSkip
)
87 throw( ::com::sun::star::io::NotConnectedException
,
88 ::com::sun::star::io::BufferSizeExceededException
,
89 ::com::sun::star::io::IOException
,
90 ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
92 virtual sal_Int32 SAL_CALL
available()
93 throw( ::com::sun::star::io::NotConnectedException
,
94 ::com::sun::star::io::IOException
,
95 ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
97 virtual void SAL_CALL
closeInput()
98 throw( ::com::sun::star::io::NotConnectedException
,
99 ::com::sun::star::io::IOException
,
100 ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
103 virtual void SAL_CALL
seek( sal_Int64 location
)
104 throw( ::com::sun::star::lang::IllegalArgumentException
,
105 ::com::sun::star::io::IOException
,
106 ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
108 virtual sal_Int64 SAL_CALL
getPosition()
109 throw( ::com::sun::star::io::IOException
,
110 ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
112 virtual sal_Int64 SAL_CALL
getLength()
113 throw( ::com::sun::star::io::IOException
,
114 ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
117 } // namespace http_dav_ucp
119 #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_SERFINPUTSTREAM_HXX
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */