michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: */ michael@0: michael@0: #ifndef _nsZipDataStream_h_ michael@0: #define _nsZipDataStream_h_ michael@0: michael@0: #include "nsZipWriter.h" michael@0: #include "nsIOutputStream.h" michael@0: #include "nsIStreamListener.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: class nsZipDataStream MOZ_FINAL : public nsIStreamListener michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSIREQUESTOBSERVER michael@0: NS_DECL_NSISTREAMLISTENER michael@0: michael@0: nsZipDataStream() michael@0: { michael@0: } michael@0: michael@0: nsresult Init(nsZipWriter *aWriter, nsIOutputStream *aStream, michael@0: nsZipHeader *aHeader, int32_t aCompression); michael@0: michael@0: nsresult ReadStream(nsIInputStream *aStream); michael@0: michael@0: private: michael@0: michael@0: nsCOMPtr mOutput; michael@0: nsCOMPtr mStream; michael@0: nsRefPtr mWriter; michael@0: nsRefPtr mHeader; michael@0: michael@0: nsresult CompleteEntry(); michael@0: nsresult ProcessData(nsIRequest *aRequest, nsISupports *aContext, michael@0: char *aBuffer, uint64_t aOffset, uint32_t aCount); michael@0: }; michael@0: michael@0: #endif