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: EntryInputStream.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 _ENTRY_INPUT_STREAM_HXX
31 #define _ENTRY_INPUT_STREAM_HXX
33 #include <cppuhelper/implbase2.hxx> // helper for implementations
34 #include <com/sun/star/io/XInputStream.hpp>
35 #include <com/sun/star/io/XSeekable.hpp>
36 #include <Inflater.hxx>
37 #include <com/sun/star/packages/zip/ZipEntry.hpp>
39 #include <vos/ref.hxx>
41 #ifndef _ENCRYPTION_DATA_HXX
42 #include <EncryptionData.hxx>
44 class EntryInputStream
: public cppu::WeakImplHelper2
< com::sun::star::io::XInputStream
,
45 com::sun::star::io::XSeekable
>
48 com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
> xStream
;
49 com::sun::star::uno::Reference
< com::sun::star::io::XSeekable
> xSeek
;
50 sal_Int64 nEnd
, nCurrent
, nUncompressedSize
;
51 sal_Bool bRawStream
, bHaveInMemory
, bEncrypted
;
52 com::sun::star::uno::Sequence
< sal_Int8
> aBuffer
;
53 const vos::ORef
< EncryptionData
> xEncryptionData
;
54 const com::sun::star::packages::zip::ZipEntry aEntry
;
57 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
59 EntryInputStream( com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
> xInput
,
60 const com::sun::star::packages::zip::ZipEntry
&rNewEntry
,
61 const vos::ORef
< EncryptionData
> &xEncryptData
,
62 sal_Bool bGetRawStream
= sal_False
);
63 virtual ~EntryInputStream();
66 virtual sal_Int32 SAL_CALL
readBytes( ::com::sun::star::uno::Sequence
< sal_Int8
>& aData
, sal_Int32 nBytesToRead
)
67 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
68 virtual sal_Int32 SAL_CALL
readSomeBytes( ::com::sun::star::uno::Sequence
< sal_Int8
>& aData
, sal_Int32 nMaxBytesToRead
)
69 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
70 virtual void SAL_CALL
skipBytes( sal_Int32 nBytesToSkip
)
71 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
72 virtual sal_Int32 SAL_CALL
available( )
73 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
74 virtual void SAL_CALL
closeInput( )
75 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
77 virtual void SAL_CALL
seek( sal_Int64 location
)
78 throw(::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
79 virtual sal_Int64 SAL_CALL
getPosition( )
80 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
81 virtual sal_Int64 SAL_CALL
getLength( )
82 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);