1*f319bb99SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f319bb99SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f319bb99SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f319bb99SAndrew Rist * distributed with this work for additional information 6*f319bb99SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f319bb99SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f319bb99SAndrew Rist * "License"); you may not use this file except in compliance 9*f319bb99SAndrew Rist * with the License. You may obtain a copy of the License at 10*f319bb99SAndrew Rist * 11*f319bb99SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f319bb99SAndrew Rist * 13*f319bb99SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f319bb99SAndrew Rist * software distributed under the License is distributed on an 15*f319bb99SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f319bb99SAndrew Rist * KIND, either express or implied. See the License for the 17*f319bb99SAndrew Rist * specific language governing permissions and limitations 18*f319bb99SAndrew Rist * under the License. 19*f319bb99SAndrew Rist * 20*f319bb99SAndrew Rist *************************************************************/ 21*f319bb99SAndrew Rist 22*f319bb99SAndrew Rist 23cdf0e10cSrcweir #ifndef _ZIP_PACKAGE_BUFFER_HXX 24cdf0e10cSrcweir #define _ZIP_PACKAGE_BUFFER_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp> 27cdf0e10cSrcweir #include <com/sun/star/io/XSeekable.hpp> 28cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp> 29cdf0e10cSrcweir #ifndef _CPPUHELPER_IMPLBASE3_HXX 30cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir 33cdf0e10cSrcweir class ZipPackage; 34cdf0e10cSrcweir 35cdf0e10cSrcweir class ZipPackageBuffer : public ::cppu::WeakImplHelper3 36cdf0e10cSrcweir < 37cdf0e10cSrcweir com::sun::star::io::XInputStream, 38cdf0e10cSrcweir com::sun::star::io::XOutputStream, 39cdf0e10cSrcweir com::sun::star::io::XSeekable 40cdf0e10cSrcweir > 41cdf0e10cSrcweir { 42cdf0e10cSrcweir protected: 43cdf0e10cSrcweir com::sun::star::uno::Sequence < sal_Int8 > m_aBuffer; 44cdf0e10cSrcweir sal_Int64 m_nBufferSize, m_nEnd, m_nCurrent; 45cdf0e10cSrcweir sal_Bool m_bMustInitBuffer; 46cdf0e10cSrcweir public: 47cdf0e10cSrcweir ZipPackageBuffer(sal_Int64 nNewBufferSize); 48cdf0e10cSrcweir virtual ~ZipPackageBuffer(void); 49cdf0e10cSrcweir realloc(sal_Int32 nSize)50cdf0e10cSrcweir inline void realloc ( sal_Int32 nSize ) { m_aBuffer.realloc ( nSize ); } getConstArray() const51cdf0e10cSrcweir inline const sal_Int8 * getConstArray () const { return m_aBuffer.getConstArray(); } getSequence() const52cdf0e10cSrcweir inline const com::sun::star::uno::Sequence < sal_Int8> getSequence () const { return m_aBuffer; } 53cdf0e10cSrcweir 54cdf0e10cSrcweir // XInputStream 55cdf0e10cSrcweir virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) 56cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 57cdf0e10cSrcweir virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) 58cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 59cdf0e10cSrcweir virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) 60cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 61cdf0e10cSrcweir virtual sal_Int32 SAL_CALL available( ) 62cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 63cdf0e10cSrcweir virtual void SAL_CALL closeInput( ) 64cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 65cdf0e10cSrcweir // XOutputStream 66cdf0e10cSrcweir virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< sal_Int8 >& aData ) 67cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 68cdf0e10cSrcweir virtual void SAL_CALL flush( ) 69cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 70cdf0e10cSrcweir virtual void SAL_CALL closeOutput( ) 71cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 72cdf0e10cSrcweir // XSeekable 73cdf0e10cSrcweir virtual void SAL_CALL seek( sal_Int64 location ) 74cdf0e10cSrcweir throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 75cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getPosition( ) 76cdf0e10cSrcweir throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 77cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getLength( ) 78cdf0e10cSrcweir throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 79cdf0e10cSrcweir }; 80cdf0e10cSrcweir #endif 81