You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Steve <co...@excite.com> on 2004/05/24 05:57:14 UTC

write function in flowscript

 The problem was that i was printing in the log before form.showForm().So the sel list value was not getting printed. I have another query. I want to copy one file to another location. I have written a function for that. Below is that function:- function copyFiles(srcFile,destFile){ try{  var inputFile = new Packages.java.io.File(srcFile);  var outputFile = new Packages.java.io.File(destFile);   cocoon.log.info("Input File is "+inputFile);  cocoon.log.info("Output File is "+outputFile);   var fileInSt = new Packages.java.io.FileInputStream(inputFile);  var buffInSt = new Packages.java.io.BufferedInputStream(fileInSt);  var sourceFile = new Packages.java.io.DataInputStream(buffInSt);  var destFile = new Packages.java.io.BufferedOutputStream(new Packages.java.io.FileOutputStream(outputFile));  }catch(e){  cocoon.log.info("File Exception"); }    var read = 0; do{  read = sourceFile.read();  destFile.write(read);  destFile.flush(); }while(read != -1);   destFile.close(); sourceFile.close();}Cocoon throws an error as follows;- 
An Error Occurred
write is not a function.
org.apache.avalon.framework.CascadingRuntimeException: write is not a function.
Can anyone tell me why is that so?
I tried using destFile["write"](read);
But it says syntax error.
Please help me in locating the error.

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!