|
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/. */ |
|
5 |
|
6 #include "nsIRequestObserver.idl" |
|
7 |
|
8 interface nsIInputStream; |
|
9 |
|
10 /** |
|
11 * nsIStreamListener |
|
12 */ |
|
13 [scriptable, uuid(3b4c8a77-76ba-4610-b316-678c73a3b88c)] |
|
14 interface nsIStreamListener : nsIRequestObserver |
|
15 { |
|
16 /** |
|
17 * Called when the next chunk of data (corresponding to the request) may |
|
18 * be read without blocking the calling thread. The onDataAvailable impl |
|
19 * must read exactly |aCount| bytes of data before returning. |
|
20 * |
|
21 * @param aRequest request corresponding to the source of the data |
|
22 * @param aContext user defined context |
|
23 * @param aInputStream input stream containing the data chunk |
|
24 * @param aOffset |
|
25 * Number of bytes that were sent in previous onDataAvailable calls |
|
26 * for this request. In other words, the sum of all previous count |
|
27 * parameters. |
|
28 * @param aCount number of bytes available in the stream |
|
29 * |
|
30 * NOTE: The aInputStream parameter must implement readSegments. |
|
31 * |
|
32 * An exception thrown from onDataAvailable has the side-effect of |
|
33 * causing the request to be canceled. |
|
34 */ |
|
35 void onDataAvailable(in nsIRequest aRequest, |
|
36 in nsISupports aContext, |
|
37 in nsIInputStream aInputStream, |
|
38 in unsigned long long aOffset, |
|
39 in unsigned long aCount); |
|
40 }; |