1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XUnbufferedStream.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _XUNBUFFERED_STREAM_HXX
31 #define _XUNBUFFERED_STREAM_HXX
33 #include <com/sun/star/io/XOutputStream.hpp>
34 #include <com/sun/star/lang/IllegalArgumentException.hpp>
35 #include <com/sun/star/io/XSeekable.hpp>
36 #include <com/sun/star/io/XInputStream.hpp>
37 #include <com/sun/star/io/XOutputStream.hpp>
38 #include <cppuhelper/implbase1.hxx>
39 #include <vos/ref.hxx>
40 #include <Inflater.hxx>
41 #include <ZipEntry.hxx>
43 #include <mutexholder.hxx>
45 #define UNBUFF_STREAM_DATA 0
46 #define UNBUFF_STREAM_RAW 1
47 #define UNBUFF_STREAM_WRAPPEDRAW 2
50 typedef void* rtlCipher
;
51 class XUnbufferedStream
: public cppu::WeakImplHelper1
53 com::sun::star::io::XInputStream
57 SotMutexHolderRef maMutexHolder
;
59 com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
> mxZipStream
;
60 com::sun::star::uno::Reference
< com::sun::star::io::XSeekable
> mxZipSeek
;
61 com::sun::star::uno::Sequence
< sal_Int8
> maCompBuffer
, maHeader
;
63 vos::ORef
< EncryptionData
> mxData
;
66 sal_Bool mbRawStream
, mbWrappedRaw
, mbFinished
;
67 sal_Int16 mnHeaderToRead
;
68 sal_Int64 mnZipCurrent
, mnZipEnd
, mnZipSize
, mnMyCurrent
;
74 SotMutexHolderRef aMutexHolder
,
76 com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
> xNewZipStream
,
77 const vos::ORef
< EncryptionData
> &rData
,
79 sal_Bool bIsEncrypted
,
80 const ::rtl::OUString
& aMediaType
,
81 sal_Bool bRecoveryMode
);
83 // allows to read package raw stream
84 XUnbufferedStream( const com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
>& xRawStream
,
85 const vos::ORef
< EncryptionData
> &rData
);
88 virtual ~XUnbufferedStream();
91 virtual sal_Int32 SAL_CALL
readBytes( ::com::sun::star::uno::Sequence
< sal_Int8
>& aData
, sal_Int32 nBytesToRead
)
92 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
93 virtual sal_Int32 SAL_CALL
readSomeBytes( ::com::sun::star::uno::Sequence
< sal_Int8
>& aData
, sal_Int32 nMaxBytesToRead
)
94 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
95 virtual void SAL_CALL
skipBytes( sal_Int32 nBytesToSkip
)
96 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
97 virtual sal_Int32 SAL_CALL
available( )
98 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
99 virtual void SAL_CALL
closeInput( )
100 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
103 virtual void SAL_CALL seek( sal_Int64 location )
104 throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
105 virtual sal_Int64 SAL_CALL getPosition( )
106 throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
107 virtual sal_Int64 SAL_CALL getLength( )
108 throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);