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: XFileStream.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 _XFILE_STREAM_HXX
31 #define _XFILE_STREAM_HXX
33 #include <com/sun/star/lang/IllegalArgumentException.hpp>
34 #include <com/sun/star/io/XSeekable.hpp>
35 #include <com/sun/star/io/XInputStream.hpp>
36 #include <cppuhelper/implbase2.hxx>
38 #include <vos/ref.hxx>
41 #include <Inflater.hxx>
43 #include <ZipEntry.hxx>
45 namespace com
{ namespace sun
{ namespace star
{
46 namespace io
{ class XOutputStream
; }
49 typedef void* rtlCipher
;
50 class XFileStream
: public cppu::WeakImplHelper2
52 com::sun::star::io::XInputStream
,
53 com::sun::star::io::XSeekable
57 com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
> mxZipStream
;
58 com::sun::star::uno::Reference
< com::sun::star::io::XSeekable
> mxZipSeek
;
59 com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
> mxTempIn
;
60 com::sun::star::uno::Reference
< com::sun::star::io::XSeekable
> mxTempSeek
;
61 com::sun::star::uno::Reference
< com::sun::star::io::XOutputStream
> mxTempOut
;
62 com::sun::star::uno::Sequence
< sal_Int8
> maBuffer
, maCompBuffer
;
64 vos::ORef
< EncryptionData
> mxData
;
67 sal_Bool mbRawStream
, mbFinished
;
68 sal_Int64 mnZipCurrent
, mnZipEnd
, mnZipSize
;
69 void fill( sal_Int64 nUntil
);
72 XFileStream( ZipEntry
& rEntry
,
73 com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
> xNewZipStream
,
74 com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
> xNewTempStream
,
75 const vos::ORef
< EncryptionData
> &rData
,
77 sal_Bool bIsEncrypted
);
78 virtual ~XFileStream();
81 virtual sal_Int32 SAL_CALL
readBytes( ::com::sun::star::uno::Sequence
< sal_Int8
>& aData
, sal_Int32 nBytesToRead
)
82 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
83 virtual sal_Int32 SAL_CALL
readSomeBytes( ::com::sun::star::uno::Sequence
< sal_Int8
>& aData
, sal_Int32 nMaxBytesToRead
)
84 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
85 virtual void SAL_CALL
skipBytes( sal_Int32 nBytesToSkip
)
86 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
87 virtual sal_Int32 SAL_CALL
available( )
88 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
89 virtual void SAL_CALL
closeInput( )
90 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
92 virtual void SAL_CALL
seek( sal_Int64 location
)
93 throw(::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
94 virtual sal_Int64 SAL_CALL
getPosition( )
95 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
96 virtual sal_Int64 SAL_CALL
getLength( )
97 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);