LibreOffice Module package (master) 1
XUnbufferedStream.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#ifndef INCLUDED_PACKAGE_SOURCE_ZIPAPI_XUNBUFFEREDSTREAM_HXX
20#define INCLUDED_PACKAGE_SOURCE_ZIPAPI_XUNBUFFEREDSTREAM_HXX
21
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>
25
28#include <rtl/ref.hxx>
29#include <package/Inflater.hxx>
30#include <ZipEntry.hxx>
31#include <CRC32.hxx>
32
33namespace com::sun::star::uno {
34 class XComponentContext;
35}
36
37#define UNBUFF_STREAM_DATA 0
38#define UNBUFF_STREAM_RAW 1
39#define UNBUFF_STREAM_WRAPPEDRAW 2
40
41class EncryptionData;
42class XUnbufferedStream final : public cppu::WeakImplHelper
43<
44 css::io::XInputStream
45>
46{
48
49 css::uno::Reference < css::io::XInputStream > mxZipStream;
50 css::uno::Reference < css::io::XSeekable > mxZipSeek;
51 css::uno::Sequence < sal_Int8 > maCompBuffer, maHeader;
53 sal_Int32 mnBlockSize;
54 css::uno::Reference< css::xml::crypto::XCipherContext > m_xCipherContext;
57 sal_Int16 mnHeaderToRead;
61
62public:
64 const css::uno::Reference< css::uno::XComponentContext >& xContext,
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 );
73
74 // allows to read package raw stream
77 const css::uno::Reference < css::io::XInputStream >& xRawStream,
78 const ::rtl::Reference< EncryptionData >& rData );
79
80 sal_Int64 getSize() const { return mnZipSize; }
81
82 virtual ~XUnbufferedStream() override;
83
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;
90};
91#endif
92
93/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: CRC32.hxx:29
css::uno::Reference< css::io::XInputStream > mxZipStream
virtual void SAL_CALL closeInput() override
virtual ~XUnbufferedStream() override
virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) override
rtl::Reference< comphelper::RefCountedMutex > maMutexHolder
virtual sal_Int32 SAL_CALL readSomeBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nMaxBytesToRead) override
virtual sal_Int32 SAL_CALL readBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nBytesToRead) override
XUnbufferedStream(rtl::Reference< comphelper::RefCountedMutex > aMutexHolder, const css::uno::Reference< css::io::XInputStream > &xRawStream, const ::rtl::Reference< EncryptionData > &rData)
css::uno::Sequence< sal_Int8 > maHeader
css::uno::Sequence< sal_Int8 > maCompBuffer
ZipUtils::Inflater maInflater
css::uno::Reference< css::xml::crypto::XCipherContext > m_xCipherContext
sal_Int64 getSize() const
css::uno::Reference< css::io::XSeekable > mxZipSeek
XUnbufferedStream(const css::uno::Reference< css::uno::XComponentContext > &xContext, rtl::Reference< comphelper::RefCountedMutex > aMutexHolder, ZipEntry const &rEntry, css::uno::Reference< css::io::XInputStream > const &xNewZipStream, const ::rtl::Reference< EncryptionData > &rData, sal_Int8 nStreamMode, bool bIsEncrypted, const OUString &aMediaType, bool bRecoveryMode)
virtual sal_Int32 SAL_CALL available() override
signed char sal_Int8