From 2d92a84a6aac37e34d1699fdebe0270468b4f746 Mon Sep 17 00:00:00 2001 From: Matúš Kukan Date: Mon, 20 Oct 2014 21:13:50 +0200 Subject: package: Move most ZipOutputEntry's methods back to ZipOutputStream We want to use ZipOutputEntry only for deflating (and maybe rename it). ca13a9377e4a36436e4c82bb33648d0f3b6db6f5 was not a good idea because the data still needs to be written sequentially anyway. Otherwise it's hard to get offset positions of individual entries right. Since this commit rawCloseEntry needs to be called always; also when we use write&closeEntry because we don't call writeEXT in closeEntry anymore. Need to rename and add comments later. Change-Id: I03bd48ca6e108e6253a77a137746165909ca3c3d --- package/inc/ZipOutputStream.hxx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'package/inc/ZipOutputStream.hxx') diff --git a/package/inc/ZipOutputStream.hxx b/package/inc/ZipOutputStream.hxx index 95c27f3a959a..6775bd02c3be 100644 --- a/package/inc/ZipOutputStream.hxx +++ b/package/inc/ZipOutputStream.hxx @@ -27,6 +27,7 @@ #include struct ZipEntry; +class ZipPackageStream; class ZipOutputStream { @@ -35,22 +36,36 @@ class ZipOutputStream ByteChucker m_aChucker; bool m_bFinished; + ZipEntry *m_pCurrentEntry; public: ZipOutputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > &xOStream ); ~ZipOutputStream(); - void addEntry( ZipEntry *pZipEntry ); + // rawWrite to support a direct write to the output stream + void rawWrite( ::com::sun::star::uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength ) + throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + void rawCloseEntry() + throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + + void putNextEntry( ZipEntry& rEntry, bool bEncrypt = false ) + throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); void finish() throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); ByteChucker& getChucker(); + static sal_uInt32 getCurrentDosTime(); + private: void writeEND(sal_uInt32 nOffset, sal_uInt32 nLength) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); void writeCEN( const ZipEntry &rEntry ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + sal_Int32 writeLOC( const ZipEntry &rEntry ) + throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + void writeEXT( const ZipEntry &rEntry ) + throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); }; #endif -- cgit