Andrew Harrison wrote:
I think I understand now. Could you verify? Having looked at nsFileChannel, I think what I need to do is:
1. implement an nsIOutputStream that writes to JNI.
2. add a flag to my channel which gets set to true if SetUploadStream is called. 3. in AsynchOpen check the flag. If true, create an output transport using nsIStreamTransportService and do a copy from input to output stream using nsIAsyncStreamCopier.

I don't really understand why you want an nsIOutputStream... unless your Java API wants one, maybe? It sounds like it will work, but if all you want is a byte[], then why don't you, in AsyncOpen, just read all of the data from the stream into such a byte array, using nsIInputStream::Read or ReadSegments or something?

The file channel code does what it does because it does want to write to a stream eventually (the file output stream). It uses the async stream copier in order not to hang the UI while it writes to the file (don't know how much of an issue that'd be for you...).


-biesi
_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to