Branch libreoffice-5-0-4
[LibreOffice.git] / include / ucbhelper / fd_inputstream.hxx
blob3c206618d60148973d8b7a59dc86c0dbc580147a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #ifndef INCLUDED_UCBHELPER_FD_INPUTSTREAM_HXX
21 #define INCLUDED_UCBHELPER_FD_INPUTSTREAM_HXX
23 #include <rtl/ustring.hxx>
24 #include <osl/mutex.hxx>
25 #include <osl/file.h>
26 #include <com/sun/star/io/XInputStream.hpp>
27 #include <com/sun/star/io/XSeekable.hpp>
28 #include <cppuhelper/implbase2.hxx>
29 #include <cppuhelper/basemutex.hxx>
31 #include <ucbhelper/ucbhelperdllapi.h>
33 namespace ucbhelper
35 typedef ::cppu::WeakImplHelper2<
36 com::sun::star::io::XInputStream,
37 com::sun::star::io::XSeekable > FdInputStream_Base;
39 /** Implements a seekable InputStream
40 * working on a buffer.
42 class UCBHELPER_DLLPUBLIC FdInputStream
43 : protected cppu::BaseMutex,
44 public FdInputStream_Base
46 public:
48 /** Defines the storage kind found
49 * on which the inputstream acts.
52 FdInputStream(oslFileHandle tmpfl = 0);
54 virtual ~FdInputStream();
56 virtual sal_Int32 SAL_CALL
57 readBytes(css::uno::Sequence< sal_Int8 >& aData,
58 sal_Int32 nBytesToRead)
59 throw( css::io::NotConnectedException,
60 css::io::BufferSizeExceededException,
61 css::io::IOException,
62 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
64 virtual sal_Int32 SAL_CALL
65 readSomeBytes(css::uno::Sequence< sal_Int8 >& aData,
66 sal_Int32 nMaxBytesToRead )
67 throw( css::io::NotConnectedException,
68 css::io::BufferSizeExceededException,
69 css::io::IOException,
70 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
72 virtual void SAL_CALL
73 skipBytes(sal_Int32 nBytesToSkip)
74 throw(css::io::NotConnectedException,
75 css::io::BufferSizeExceededException,
76 css::io::IOException,
77 css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
79 virtual sal_Int32 SAL_CALL
80 available()
81 throw(css::io::NotConnectedException,
82 css::io::IOException,
83 css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
85 virtual void SAL_CALL
86 closeInput()
87 throw(css::io::NotConnectedException,
88 css::io::IOException,
89 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
92 /** XSeekable
95 virtual void SAL_CALL
96 seek(sal_Int64 location)
97 throw(css::lang::IllegalArgumentException,
98 css::io::IOException,
99 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 virtual sal_Int64 SAL_CALL
103 getPosition()
104 throw(css::io::IOException,
105 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
108 virtual sal_Int64 SAL_CALL
109 getLength()
110 throw(css::io::IOException,
111 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 private:
114 oslFileHandle m_tmpfl;
115 sal_uInt64 m_nLength;
119 #endif
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */