cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From H.vanderLin...@MI.unimaas.nl
Subject RE: write function in flowscript
Date Mon, 24 May 2004 10:49:30 GMT
Hi,
 
I notice you reuse the parameter name for a variable later. If I'm correct
the first assignment determines more or less the datatype of the variable.
Could that be the problem?
 
HTH
 
Bye, Helma

-----Original Message-----
From: Steve [mailto:coconaka@excite.com] 
Sent: Monday, 24 May 2004 05:57
To: users@cocoon.apache.org
Subject: 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(ou tputFile));

}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 <http://www.excite.com> 
The most personalized portal on the Web! 


Mime
View raw message