|
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 #include "nsAutoPtr.h" |
|
13 #include "mozilla/Attributes.h" |
|
14 |
|
15 class nsZipDataStream MOZ_FINAL : public nsIStreamListener |
|
16 { |
|
17 public: |
|
18 NS_DECL_THREADSAFE_ISUPPORTS |
|
19 NS_DECL_NSIREQUESTOBSERVER |
|
20 NS_DECL_NSISTREAMLISTENER |
|
21 |
|
22 nsZipDataStream() |
|
23 { |
|
24 } |
|
25 |
|
26 nsresult Init(nsZipWriter *aWriter, nsIOutputStream *aStream, |
|
27 nsZipHeader *aHeader, int32_t aCompression); |
|
28 |
|
29 nsresult ReadStream(nsIInputStream *aStream); |
|
30 |
|
31 private: |
|
32 |
|
33 nsCOMPtr<nsIStreamListener> mOutput; |
|
34 nsCOMPtr<nsIOutputStream> mStream; |
|
35 nsRefPtr<nsZipWriter> mWriter; |
|
36 nsRefPtr<nsZipHeader> mHeader; |
|
37 |
|
38 nsresult CompleteEntry(); |
|
39 nsresult ProcessData(nsIRequest *aRequest, nsISupports *aContext, |
|
40 char *aBuffer, uint64_t aOffset, uint32_t aCount); |
|
41 }; |
|
42 |
|
43 #endif |