Thanks a lot for the reply Neil!
It works beautifully now :)

Oh, another thing though, Now that I have downloaded and saved the
Jpoeg file, I want to read it and append it to another jpeg file. So i
was looking for a way to read/write binary files.


I tried:

var file =
Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);

file.initWithPath("C:\\Documents and
Settings\\sina\\Desktop\\temp_image.jpg");

 var fileInputStream =
Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
 fileInputStream.init(file, 0x01, 00004, null);

 var binaryInputStream =
Components.classes["@mozilla.org/binaryinputstream;1"].createInstance(Components.interfaces.nsIBinaryInputStream);
 binaryInputStream.setInputStream(fileInputStream);

var sInputStream =
Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream);
sInputStream.init(binaryInputStream);

return sInputStream.read(sInputStream.available());

the issue is i think sInputStream.read() returns everything as a
string.. . but i dont know how to get around this...

(I'm sorry if these are all nOOb questions.. I just got started on
XPCOM one week ago...)

Thanks once again for your help, I appreciate it!

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

Reply via email to