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 #include <rtl/ustring.hxx>
22 #include <com/sun/star/io/XSeekable.hpp>
23 #include <com/sun/star/io/XTruncate.hpp>
24 #include <com/sun/star/io/XInputStream.hpp>
25 #include <com/sun/star/io/XOutputStream.hpp>
26 #include <com/sun/star/io/XStream.hpp>
27 #include <com/sun/star/io/XAsyncOutputMonitor.hpp>
28 #include <com/sun/star/lang/XUnoTunnel.hpp>
29 #include <comphelper/bytereader.hxx>
30 #include <cppuhelper/implbase.hxx>
35 namespace fileaccess
{
40 class XStream_impl
: public cppu::WeakImplHelper
<
43 css::io::XInputStream
,
44 css::io::XOutputStream
,
46 css::io::XAsyncOutputMonitor
>,
47 public comphelper::ByteReader
52 XStream_impl( const OUString
& aUncPath
, bool bLock
);
55 * Returns an error code as given by filerror.hxx
58 sal_Int32
CtorSuccess() const { return m_nErrorCode
;}
59 sal_Int32
getMinorError() const { return m_nMinorErrorCode
;}
61 virtual ~XStream_impl() override
;
65 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
66 getInputStream() override
;
68 virtual css::uno::Reference
< css::io::XOutputStream
> SAL_CALL
69 getOutputStream() override
;
74 virtual void SAL_CALL
truncate() override
;
81 css::uno::Sequence
< sal_Int8
>& aData
,
82 sal_Int32 nBytesToRead
) override
;
86 css::uno::Sequence
< sal_Int8
>& aData
,
87 sal_Int32 nMaxBytesToRead
) override
;
91 skipBytes( sal_Int32 nBytesToSkip
) override
;
97 closeInput() override
;
102 seek( sal_Int64 location
) override
;
105 getPosition() override
;
108 getLength() override
;
114 writeBytes( const css::uno::Sequence
< sal_Int8
>& aData
) override
;
122 closeOutput() override
;
124 virtual void SAL_CALL
waitForCompletion() override
;
130 sal_Int32 nMaxBytesToRead
) override
;
135 bool m_bInputStreamCalled
,m_bOutputStreamCalled
;
138 ReconnectingFile m_aFile
;
140 sal_Int32 m_nErrorCode
;
141 sal_Int32 m_nMinorErrorCode
;
143 // Implementation methods
145 /// @throws css::io::NotConnectedException
146 /// @throws css::io::IOException
147 /// @throws css::uno::RuntimeException
153 } // end namespace XStream_impl
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */