bump product version to 7.6.3.2-android
[LibreOffice.git] / package / source / zipapi / XUnbufferedStream.hxx
blobaf57706386c3599d6cac6f1718b16d7cdbf464cc
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 .
19 #ifndef INCLUDED_PACKAGE_SOURCE_ZIPAPI_XUNBUFFEREDSTREAM_HXX
20 #define INCLUDED_PACKAGE_SOURCE_ZIPAPI_XUNBUFFEREDSTREAM_HXX
22 #include <com/sun/star/io/XSeekable.hpp>
23 #include <com/sun/star/io/XInputStream.hpp>
24 #include <com/sun/star/xml/crypto/XCipherContext.hpp>
26 #include <comphelper/refcountedmutex.hxx>
27 #include <cppuhelper/implbase.hxx>
28 #include <rtl/ref.hxx>
29 #include <package/Inflater.hxx>
30 #include <ZipEntry.hxx>
31 #include <CRC32.hxx>
33 namespace com::sun::star::uno {
34 class XComponentContext;
37 #define UNBUFF_STREAM_DATA 0
38 #define UNBUFF_STREAM_RAW 1
39 #define UNBUFF_STREAM_WRAPPEDRAW 2
41 class EncryptionData;
42 class XUnbufferedStream final : public cppu::WeakImplHelper
44 css::io::XInputStream
47 rtl::Reference<comphelper::RefCountedMutex> maMutexHolder;
49 css::uno::Reference < css::io::XInputStream > mxZipStream;
50 css::uno::Reference < css::io::XSeekable > mxZipSeek;
51 css::uno::Sequence < sal_Int8 > maCompBuffer, maHeader;
52 ZipEntry maEntry;
53 sal_Int32 mnBlockSize;
54 css::uno::Reference< css::xml::crypto::XCipherContext > m_xCipherContext;
55 ZipUtils::Inflater maInflater;
56 bool mbRawStream, mbWrappedRaw;
57 sal_Int16 mnHeaderToRead;
58 sal_Int64 mnZipCurrent, mnZipEnd, mnZipSize, mnMyCurrent;
59 CRC32 maCRC;
60 bool mbCheckCRC;
62 public:
63 XUnbufferedStream(
64 const css::uno::Reference< css::uno::XComponentContext >& xContext,
65 rtl::Reference<comphelper::RefCountedMutex> aMutexHolder,
66 ZipEntry const & rEntry,
67 css::uno::Reference < css::io::XInputStream > const & xNewZipStream,
68 const ::rtl::Reference< EncryptionData >& rData,
69 sal_Int8 nStreamMode,
70 bool bIsEncrypted,
71 const OUString& aMediaType,
72 bool bRecoveryMode );
74 // allows to read package raw stream
75 XUnbufferedStream(
76 rtl::Reference<comphelper::RefCountedMutex> aMutexHolder,
77 const css::uno::Reference < css::io::XInputStream >& xRawStream,
78 const ::rtl::Reference< EncryptionData >& rData );
80 sal_Int64 getSize() const { return mnZipSize; }
82 virtual ~XUnbufferedStream() override;
84 // XInputStream
85 virtual sal_Int32 SAL_CALL readBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) override;
86 virtual sal_Int32 SAL_CALL readSomeBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) override;
87 virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) override;
88 virtual sal_Int32 SAL_CALL available( ) override;
89 virtual void SAL_CALL closeInput( ) override;
91 #endif
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */