michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsIRequestObserver.idl" michael@0: michael@0: interface nsIInputStream; michael@0: michael@0: /** michael@0: * nsIStreamListener michael@0: */ michael@0: [scriptable, uuid(3b4c8a77-76ba-4610-b316-678c73a3b88c)] michael@0: interface nsIStreamListener : nsIRequestObserver michael@0: { michael@0: /** michael@0: * Called when the next chunk of data (corresponding to the request) may michael@0: * be read without blocking the calling thread. The onDataAvailable impl michael@0: * must read exactly |aCount| bytes of data before returning. michael@0: * michael@0: * @param aRequest request corresponding to the source of the data michael@0: * @param aContext user defined context michael@0: * @param aInputStream input stream containing the data chunk michael@0: * @param aOffset michael@0: * Number of bytes that were sent in previous onDataAvailable calls michael@0: * for this request. In other words, the sum of all previous count michael@0: * parameters. michael@0: * @param aCount number of bytes available in the stream michael@0: * michael@0: * NOTE: The aInputStream parameter must implement readSegments. michael@0: * michael@0: * An exception thrown from onDataAvailable has the side-effect of michael@0: * causing the request to be canceled. michael@0: */ michael@0: void onDataAvailable(in nsIRequest aRequest, michael@0: in nsISupports aContext, michael@0: in nsIInputStream aInputStream, michael@0: in unsigned long long aOffset, michael@0: in unsigned long aCount); michael@0: };