Line data Source code
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 final : public nsIStreamListener
16 : {
17 : public:
18 : NS_DECL_THREADSAFE_ISUPPORTS
19 : NS_DECL_NSIREQUESTOBSERVER
20 : NS_DECL_NSISTREAMLISTENER
21 :
22 0 : nsZipDataStream()
23 0 : {
24 0 : }
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 0 : ~nsZipDataStream() {}
34 :
35 : nsCOMPtr<nsIStreamListener> mOutput;
36 : nsCOMPtr<nsIOutputStream> mStream;
37 : RefPtr<nsZipWriter> mWriter;
38 : RefPtr<nsZipHeader> mHeader;
39 :
40 : nsresult CompleteEntry();
41 : nsresult ProcessData(nsIRequest *aRequest, nsISupports *aContext,
42 : char *aBuffer, uint64_t aOffset, uint32_t aCount);
43 : };
44 :
45 : #endif
|