1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsIInputStream.idl"
8 interface nsIOutputStream
;
9 interface nsIEventTarget
;
12 * A nsIInputStreamTee is a wrapper for an input stream, that when read
13 * reads the specified amount of data from its |source| and copies that
14 * data to its |sink|. |sink| must be a blocking output stream.
16 [scriptable
, builtinclass
, uuid(90a9d790
-3bca
-421e
-a73b
-98f68e13c917
)]
17 interface nsIInputStreamTee
: nsIInputStream
19 attribute nsIInputStream
source;
20 attribute nsIOutputStream sink
;
23 * If |eventTarget| is set, copying to sink is done asynchronously using
24 * the event-target (e.g. a thread). If |eventTarget| is not set, copying
25 * to sink happens synchronously while reading from the source.
27 attribute nsIEventTarget eventTarget
;
33 NS_NewInputStreamTee
(nsIInputStream
**tee
, // read from this input stream
34 nsIInputStream
*source,
35 nsIOutputStream
*sink
);
38 NS_NewInputStreamTeeAsync
(nsIInputStream
**tee
, // read from this input stream
39 nsIInputStream
*source,
40 nsIOutputStream
*sink
,
41 nsIEventTarget
*eventTarget
);