2010-10-27 12:45:03 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2001-12-04 16:45:30 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 15:47:17 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2001-12-04 16:45:30 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2001-12-04 16:45:30 +00:00
|
|
|
*
|
2008-04-10 15:47:17 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-12-04 16:45:30 +00:00
|
|
|
*
|
2008-04-10 15:47:17 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2001-12-04 16:45:30 +00:00
|
|
|
*
|
2008-04-10 15:47:17 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2001-12-04 16:45:30 +00:00
|
|
|
*
|
2008-04-10 15:47:17 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2001-12-04 16:45:30 +00:00
|
|
|
*
|
2008-04-10 15:47:17 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2001-12-04 16:45:30 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#ifndef _XUNBUFFERED_STREAM_HXX
|
|
|
|
#define _XUNBUFFERED_STREAM_HXX
|
|
|
|
|
|
|
|
#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>
|
|
|
|
#include <cppuhelper/implbase1.hxx>
|
2010-10-15 12:18:51 -05:00
|
|
|
#include <rtl/ref.hxx>
|
2001-12-04 16:45:30 +00:00
|
|
|
#include <Inflater.hxx>
|
|
|
|
#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
|
|
|
|
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;
|
|
|
|
typedef void* rtlCipher;
|
|
|
|
class XUnbufferedStream : public cppu::WeakImplHelper1
|
|
|
|
<
|
|
|
|
com::sun::star::io::XInputStream
|
|
|
|
>
|
|
|
|
{
|
|
|
|
protected:
|
2009-09-08 08:54:47 +00:00
|
|
|
SotMutexHolderRef maMutexHolder;
|
|
|
|
|
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;
|
2010-10-15 12:18:51 -05:00
|
|
|
rtl::Reference < EncryptionData > mxData;
|
2001-12-04 16:45:30 +00:00
|
|
|
rtlCipher maCipher;
|
|
|
|
Inflater maInflater;
|
2003-09-11 09:17:08 +00:00
|
|
|
sal_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;
|
2003-09-11 09:17:08 +00:00
|
|
|
sal_Bool mbCheckCRC;
|
2001-12-04 16:45:30 +00:00
|
|
|
|
|
|
|
public:
|
2009-09-08 08:54:47 +00:00
|
|
|
XUnbufferedStream(
|
|
|
|
SotMutexHolderRef aMutexHolder,
|
|
|
|
ZipEntry & rEntry,
|
2001-12-04 16:45:30 +00:00
|
|
|
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewZipStream,
|
2010-10-15 12:18:51 -05:00
|
|
|
const rtl::Reference < EncryptionData > &rData,
|
2003-09-11 09:17:08 +00:00
|
|
|
sal_Int8 nStreamMode,
|
|
|
|
sal_Bool bIsEncrypted,
|
2005-03-15 10:50:05 +00:00
|
|
|
const ::rtl::OUString& aMediaType,
|
|
|
|
sal_Bool bRecoveryMode );
|
2003-09-11 09:17:08 +00:00
|
|
|
|
|
|
|
// allows to read package raw stream
|
|
|
|
XUnbufferedStream( const com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xRawStream,
|
2010-10-15 12:18:51 -05:00
|
|
|
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 )
|
|
|
|
throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
|
|
|
|
throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
|
|
|
|
throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual sal_Int32 SAL_CALL available( )
|
|
|
|
throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual void SAL_CALL closeInput( )
|
|
|
|
throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
|
|
|
|
// 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: */
|