Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / ucbhelper / fd_inputstream.hxx
blobda0aec5ac1e6b09845c55837afc11ec8d1fa6811
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/implbase.hxx>
29 #include <cppuhelper/basemutex.hxx>
31 #include <ucbhelper/ucbhelperdllapi.h>
33 namespace ucbhelper
35 typedef cppu::WeakImplHelper<
36 css::io::XInputStream,
37 css::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.
51 FdInputStream(oslFileHandle tmpfl);
53 virtual ~FdInputStream() override;
55 virtual sal_Int32 SAL_CALL
56 readBytes(css::uno::Sequence< sal_Int8 >& aData,
57 sal_Int32 nBytesToRead) override;
59 virtual sal_Int32 SAL_CALL
60 readSomeBytes(css::uno::Sequence< sal_Int8 >& aData,
61 sal_Int32 nMaxBytesToRead ) override;
63 virtual void SAL_CALL
64 skipBytes(sal_Int32 nBytesToSkip) override;
66 virtual sal_Int32 SAL_CALL
67 available() override;
69 virtual void SAL_CALL
70 closeInput() override;
73 /** XSeekable
76 virtual void SAL_CALL
77 seek(sal_Int64 location) override;
80 virtual sal_Int64 SAL_CALL
81 getPosition() override;
84 virtual sal_Int64 SAL_CALL
85 getLength() override;
87 private:
88 oslFileHandle m_tmpfl;
89 sal_uInt64 m_nLength;
93 #endif
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */