nsZipDataStream.h (1059B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 */ 5 6 #ifndef _nsZipDataStream_h_ 7 #define _nsZipDataStream_h_ 8 9 #include "nsZipWriter.h" 10 #include "nsIOutputStream.h" 11 #include "nsIStreamListener.h" 12 13 class nsZipDataStream final : public nsIStreamListener { 14 public: 15 NS_DECL_THREADSAFE_ISUPPORTS 16 NS_DECL_NSIREQUESTOBSERVER 17 NS_DECL_NSISTREAMLISTENER 18 19 nsZipDataStream() {} 20 21 nsresult Init(nsZipWriter* aWriter, nsIOutputStream* aStream, 22 nsZipHeader* aHeader, int32_t aCompression); 23 24 nsresult ReadStream(nsIInputStream* aStream); 25 26 private: 27 ~nsZipDataStream() {} 28 29 nsCOMPtr<nsIStreamListener> mOutput; 30 nsCOMPtr<nsIOutputStream> mStream; 31 RefPtr<nsZipWriter> mWriter; 32 RefPtr<nsZipHeader> mHeader; 33 34 nsresult CompleteEntry(); 35 nsresult ProcessData(nsIRequest* aRequest, nsISupports* aContext, 36 char* aBuffer, uint64_t aOffset, uint32_t aCount); 37 }; 38 39 #endif