I am having a problem writing a gzip file from my flowscript. My basic goal
is to use flow to gzip existing html documents. The gzip file is being
created, but is empty (the source file is definitely not empty). Here is the
relevant part of the code I am using:
try {
var sep = java.io.File.separator;
// Create the GZIP output stream
var outFilename = "path"+sep+"to"+sep+"file"+sep+"filename.gzip";
//absolute file path
var out = new java.util.zip.GZIPOutputStream(new
java.io.FileOutputStream(outFilename));
// Open the input file
var inFilename = "path"+sep+"to"+sep+"file"+sep+"filename.html";
//absolute file path
java.lang.System.out.println(inFilename);
var lineIn = new java.io.FileInputStream(inFilename);
// Transfer bytes from the input file to the GZIP output stream
/* --Original Code Sample:
* --(ByteArrayOutputStream used instead to get through the
javascript-ness of flowscript types)
* var buf = new byte[1024];
*/
var myByteArray = new java.io.ByteArrayOutputStream(1024);
var buf = myByteArray.toByteArray();
var len;
while ((len = lineIn.read(buf)) > 0) {
out.write(buf, 0, len);
}
lineIn.close();
// Complete the GZIP file
out.finish();
out.close();
} catch (e) {
java.lang.System.out.println(e);
}
At this point, when I run the code, no errors appear in any of the logs. Any
ideas what I'm doing wrong?
--
View this message in context:
http://www.nabble.com/FileInputStream-GZIPOutputStream-in-flow-tp18577080p18577080.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]