2010-10-27 12:45:03 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-22 18:32:07 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2014-04-18 22:14:30 +02:00
|
|
|
#ifndef INCLUDED_PACKAGE_SOURCE_ZIPAPI_XUNBUFFEREDSTREAM_HXX
|
|
|
|
#define INCLUDED_PACKAGE_SOURCE_ZIPAPI_XUNBUFFEREDSTREAM_HXX
|
2001-12-04 16:45:30 +00:00
|
|
|
|
|
|
|
#include <com/sun/star/lang/IllegalArgumentException.hpp>
|
|
|
|
#include <com/sun/star/io/XSeekable.hpp>
|
|
|
|
#include <com/sun/star/io/XInputStream.hpp>
|
|
|
|
#include <com/sun/star/io/XOutputStream.hpp>
|
2011-08-21 18:12:16 -05:00
|
|
|
#include <com/sun/star/xml/crypto/XCipherContext.hpp>
|
|
|
|
|
2001-12-04 16:45:30 +00:00
|
|
|
#include <cppuhelper/implbase1.hxx>
|
2010-10-15 12:18:51 -05:00
|
|
|
#include <rtl/ref.hxx>
|
2011-08-26 14:04:17 +02:00
|
|
|
#include <package/Inflater.hxx>
|
2001-12-04 16:45:30 +00:00
|
|
|
#include <ZipEntry.hxx>
|
2003-03-26 13:16:07 +00:00
|
|
|
#include <CRC32.hxx>
|
2009-09-08 08:54:47 +00:00
|
|
|
#include <mutexholder.hxx>
|
2001-12-04 16:45:30 +00:00
|
|
|
|
2013-12-17 16:15:48 +01:00
|
|
|
namespace com { namespace sun { namespace star { namespace uno {
|
|
|
|
class XComponentContext;
|
|
|
|
} } } }
|
|
|
|
|
2003-09-11 09:17:08 +00:00
|
|
|
#define UNBUFF_STREAM_DATA 0
|
|
|
|
#define UNBUFF_STREAM_RAW 1
|
|
|
|
#define UNBUFF_STREAM_WRAPPEDRAW 2
|
|
|
|
|
2001-12-04 16:45:30 +00:00
|
|
|
class EncryptionData;
|
|
|
|
class XUnbufferedStream : public cppu::WeakImplHelper1
|
|
|
|
<
|
|
|
|
com::sun::star::io::XInputStream
|
|
|
|
>
|
|
|
|
{
|
|
|
|
protected:
|
2015-06-29 09:15:16 +02:00
|
|
|
rtl::Reference<SotMutexHolder> maMutexHolder;
|
2009-09-08 08:54:47 +00:00
|
|
|
|
2001-12-04 16:45:30 +00:00
|
|
|
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > mxZipStream;
|
|
|
|
com::sun::star::uno::Reference < com::sun::star::io::XSeekable > mxZipSeek;
|
|
|
|
com::sun::star::uno::Sequence < sal_Int8 > maCompBuffer, maHeader;
|
|
|
|
ZipEntry maEntry;
|
2011-08-21 18:12:16 -05:00
|
|
|
::rtl::Reference< EncryptionData > mxData;
|
|
|
|
sal_Int32 mnBlockSize;
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext > m_xCipherContext;
|
2011-03-29 14:18:56 +02:00
|
|
|
ZipUtils::Inflater maInflater;
|
2014-04-17 13:40:46 +02:00
|
|
|
bool mbRawStream, mbWrappedRaw, mbFinished;
|
2001-12-04 16:45:30 +00:00
|
|
|
sal_Int16 mnHeaderToRead;
|
|
|
|
sal_Int64 mnZipCurrent, mnZipEnd, mnZipSize, mnMyCurrent;
|
2003-03-26 13:16:07 +00:00
|
|
|
CRC32 maCRC;
|
2014-04-17 13:40:46 +02:00
|
|
|
bool mbCheckCRC;
|
2001-12-04 16:45:30 +00:00
|
|
|
|
|
|
|
public:
|
2009-09-08 08:54:47 +00:00
|
|
|
XUnbufferedStream(
|
2012-10-31 14:58:31 +02:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
|
2015-06-29 09:15:16 +02:00
|
|
|
const rtl::Reference<SotMutexHolder>& aMutexHolder,
|
2009-09-08 08:54:47 +00:00
|
|
|
ZipEntry & rEntry,
|
2001-12-04 16:45:30 +00:00
|
|
|
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewZipStream,
|
2011-08-21 18:12:16 -05:00
|
|
|
const ::rtl::Reference< EncryptionData >& rData,
|
2003-09-11 09:17:08 +00:00
|
|
|
sal_Int8 nStreamMode,
|
2014-04-17 13:40:46 +02:00
|
|
|
bool bIsEncrypted,
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& aMediaType,
|
2014-04-17 13:40:46 +02:00
|
|
|
bool bRecoveryMode );
|
2003-09-11 09:17:08 +00:00
|
|
|
|
|
|
|
// allows to read package raw stream
|
2011-08-21 18:12:16 -05:00
|
|
|
XUnbufferedStream(
|
2012-10-31 14:58:31 +02:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
|
2011-08-21 18:12:16 -05:00
|
|
|
const com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xRawStream,
|
|
|
|
const ::rtl::Reference< EncryptionData >& rData );
|
2003-09-11 09:17:08 +00:00
|
|
|
|
2001-12-04 16:45:30 +00:00
|
|
|
virtual ~XUnbufferedStream();
|
|
|
|
|
|
|
|
// XInputStream
|
|
|
|
virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
|
2014-03-26 16:37:00 +01:00
|
|
|
throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2001-12-04 16:45:30 +00:00
|
|
|
virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
|
2014-03-26 16:37:00 +01:00
|
|
|
throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2001-12-04 16:45:30 +00:00
|
|
|
virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
|
2014-03-26 16:37:00 +01:00
|
|
|
throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2001-12-04 16:45:30 +00:00
|
|
|
virtual sal_Int32 SAL_CALL available( )
|
2014-03-26 16:37:00 +01:00
|
|
|
throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2001-12-04 16:45:30 +00:00
|
|
|
virtual void SAL_CALL closeInput( )
|
2014-03-26 16:37:00 +01:00
|
|
|
throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
2001-12-04 16:45:30 +00:00
|
|
|
// XSeekable
|
|
|
|
/*
|
|
|
|
virtual void SAL_CALL seek( sal_Int64 location )
|
|
|
|
throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual sal_Int64 SAL_CALL getPosition( )
|
|
|
|
throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual sal_Int64 SAL_CALL getLength( )
|
|
|
|
throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
|
|
|
|
*/
|
|
|
|
};
|
|
|
|
#endif
|
2010-10-27 12:45:03 +01:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|