Classes which want to consume data from a
nsIChannel need to implement this interface.
nsIRequestObserver contains two methods. So, in all the three methods -
nsIRequestObserver.onStopRequest() have to be implemented.
This method is called when the next chunk of data for the ongoing request may be read without blocking the calling thread. The data can be read from the nsIInputStream object passed as the argument to this method.
aCountbytes of data before returning.
void onDataAvailable( in nsIRequest aRequest, in nsISupports aContext, in nsIInputStream aInputStream, in unsigned long aOffset, in unsigned long aCount );
nsIRequestindicating the source of the data.
- A user-defined context value.
nsIInputStreamfrom which the data is to be read.
- Number of bytes that were sent in previous
onDataAvailable()calls for this request. In other words, the sum of all previous count parameters. If that number is greater than or equal to 2^32, this parameter will be PR_UINT32_MAX (2^32 - 1).
- The number of bytes available for reading. You must read all of these bytes before returning to the caller.