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: ZipPackageBuffer.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 _ZIP_PACKAGE_BUFFER_HXX
31 #define _ZIP_PACKAGE_BUFFER_HXX
33 #include <com/sun/star/io/XOutputStream.hpp>
34 #include <com/sun/star/io/XSeekable.hpp>
35 #include <com/sun/star/io/XInputStream.hpp>
36 #ifndef _CPPUHELPER_IMPLBASE3_HXX
37 #include <cppuhelper/implbase3.hxx>
42 class ZipPackageBuffer
: public ::cppu::WeakImplHelper3
44 com::sun::star::io::XInputStream
,
45 com::sun::star::io::XOutputStream
,
46 com::sun::star::io::XSeekable
50 com::sun::star::uno::Sequence
< sal_Int8
> m_aBuffer
;
51 sal_Int64 m_nBufferSize
, m_nEnd
, m_nCurrent
;
52 sal_Bool m_bMustInitBuffer
;
54 ZipPackageBuffer(sal_Int64 nNewBufferSize
);
55 virtual ~ZipPackageBuffer(void);
57 inline void realloc ( sal_Int32 nSize
) { m_aBuffer
.realloc ( nSize
); }
58 inline const sal_Int8
* getConstArray () const { return m_aBuffer
.getConstArray(); }
59 inline const com::sun::star::uno::Sequence
< sal_Int8
> getSequence () const { return m_aBuffer
; }
62 virtual sal_Int32 SAL_CALL
readBytes( ::com::sun::star::uno::Sequence
< sal_Int8
>& aData
, sal_Int32 nBytesToRead
)
63 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
64 virtual sal_Int32 SAL_CALL
readSomeBytes( ::com::sun::star::uno::Sequence
< sal_Int8
>& aData
, sal_Int32 nMaxBytesToRead
)
65 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
66 virtual void SAL_CALL
skipBytes( sal_Int32 nBytesToSkip
)
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
available( )
69 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
70 virtual void SAL_CALL
closeInput( )
71 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
73 virtual void SAL_CALL
writeBytes( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aData
)
74 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
75 virtual void SAL_CALL
flush( )
76 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
77 virtual void SAL_CALL
closeOutput( )
78 throw(::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
80 virtual void SAL_CALL
seek( sal_Int64 location
)
81 throw(::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
82 virtual sal_Int64 SAL_CALL
getPosition( )
83 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
84 virtual sal_Int64 SAL_CALL
getLength( )
85 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);