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/.
10 #ifndef INCLUDED_UCBHELPER_STD_INPUTSTREAM_HXX
11 #define INCLUDED_UCBHELPER_STD_INPUTSTREAM_HXX
13 #include <boost/shared_ptr.hpp>
16 #include <rtl/ustring.hxx>
17 #include <osl/mutex.hxx>
18 #include <cppuhelper/weak.hxx>
19 #include <cppuhelper/queryinterface.hxx>
20 #include <com/sun/star/io/XInputStream.hpp>
21 #include <com/sun/star/io/XSeekable.hpp>
23 #include <ucbhelper/ucbhelperdllapi.h>
27 /** Implements a seekable InputStream
28 * working on an std::istream
30 class UCBHELPER_DLLPUBLIC StdInputStream
31 : public cppu::OWeakObject
,
32 public com::sun::star::io::XInputStream
,
33 public com::sun::star::io::XSeekable
37 StdInputStream( boost::shared_ptr
< std::istream
> pStream
);
39 virtual ~StdInputStream();
41 virtual css::uno::Any SAL_CALL
queryInterface ( const css::uno::Type
& rType
)
42 throw ( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
44 virtual void SAL_CALL
acquire( ) throw ( ) SAL_OVERRIDE
;
46 virtual void SAL_CALL
release( ) throw ( ) SAL_OVERRIDE
;
48 virtual sal_Int32 SAL_CALL
49 readBytes ( css::uno::Sequence
< sal_Int8
>& aData
,
50 sal_Int32 nBytesToRead
)
51 throw ( css::io::NotConnectedException
,
52 css::io::BufferSizeExceededException
,
54 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
56 virtual sal_Int32 SAL_CALL
57 readSomeBytes ( css::uno::Sequence
< sal_Int8
>& aData
,
58 sal_Int32 nMaxBytesToRead
)
59 throw ( css::io::NotConnectedException
,
60 css::io::BufferSizeExceededException
,
62 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
65 skipBytes ( sal_Int32 nBytesToSkip
)
66 throw ( css::io::NotConnectedException
,
67 css::io::BufferSizeExceededException
,
69 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
71 virtual sal_Int32 SAL_CALL
73 throw ( css::io::NotConnectedException
,
75 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
79 throw ( css::io::NotConnectedException
,
81 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
88 seek ( sal_Int64 location
)
89 throw ( css::lang::IllegalArgumentException
,
91 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
94 virtual sal_Int64 SAL_CALL
96 throw ( css::io::IOException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 virtual sal_Int64 SAL_CALL
101 throw ( css::io::IOException
,
102 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
107 boost::shared_ptr
< std::istream
> m_pStream
;
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */