Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsISupports.idl"
9 %{C++
10 #include "nsDependentString.h"
11 %}
13 interface nsIFile;
15 /**
16 * A simple interface for writing to a .gz file.
17 *
18 * Note that the file that this interface produces has a different format than
19 * what you'd get if you compressed your data as a gzip stream and dumped the
20 * result to a file.
21 *
22 * The standard gunzip tool cannot decompress a raw gzip stream, but can handle
23 * the files produced by this interface.
24 */
25 [scriptable, uuid(a256f26a-c603-459e-b5a4-53b4877f2cd8)]
26 interface nsIGZFileWriter : nsISupports
27 {
28 /**
29 * Initialize this object. We'll write our gzip'ed data to the given file,
30 * overwriting its contents if the file exists.
31 *
32 * init() will return an error if called twice. It's an error to call any
33 * other method on this interface without first calling init().
34 */
35 void init(in nsIFile file);
37 /**
38 * Write the given string to the file.
39 */
40 void write(in AUTF8String str);
42 /*
43 * The following two overloads of Write() are C++ because we can't overload
44 * methods in XPIDL. Anyway, they don't add much functionality for JS
45 * callers.
46 */
47 %{C++
48 /**
49 * Write the given char* to the file (not including the null-terminator).
50 */
51 nsresult Write(const char* str)
52 {
53 return Write(str, strlen(str));
54 }
56 /**
57 * Write |length| bytes of |str| to the file.
58 */
59 nsresult Write(const char* str, uint32_t len)
60 {
61 return Write(nsDependentCString(str, len));
62 }
63 %}
65 /**
66 * Close this nsIGZFileWriter. Classes implementing nsIGZFileWriter will run
67 * this method when the underlying object is destroyed, so it's not strictly
68 * necessary to explicitly call it from your code.
69 *
70 * It's an error to call this method twice, and it's an error to call write()
71 * after finish() has been called.
72 */
73 void finish();
74 };