1

I am working on a xul firefox-extension and have a binary value that I want to write to a file using NetUtil.asyncCopy. I have the data in an array of byte values, and need to convert it into an nsIInputStream so that asyncCopy can accept it.

I know from mozilla docs that I can convert a string to a nsIInputStream using

Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].
     createInstance(Components.interfaces.nsIScriptableUnicodeConverter);

But cannot find any corresponding method to convert an array to an inputstream. Is there an approach that will allow me to do that? (or a different workaround)

4

1 回答 1

1

这不是一个特别深刻的答案,但此示例提供了另一种保存值的途径。这是以同步写入为代价的,但就我而言,我可以处理。

于 2013-10-22T23:27:45.930 回答