We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › How to use gzipOutput()
Page Index Toggle Pages: 1
How to use gzipOutput() ? (Read 705 times)
How to use gzipOutput() ?
Sep 29th, 2005, 5:05am
 
I'm not familiar with java's OutputStream concept and I don't see how I could use gzipOutput. Where should I use gzip? Here's an example:
Code:

void gzWrite(String fileName, String[] textLines){
try {
OutputStream output = new BufferedOutputStream( new FileOutputStream(fileName),3200 );
saveStrings(gzipOutput(output),textLines);
}
catch (IOException e) {
e.printStackTrace();
}
}
Re: How to use gzipOutput() ?
Reply #1 - Sep 30th, 2005, 11:33am
 
I think this can help you:

Quote:


String[] cadena = {
 "A", "B", "C", "D", "E", "F"};


void setup()
{
 gzWrite("test.gz", cadena);

}

void gzWrite(String fileName, String[] textLines){

 OutputStream outArchivo;
 File file = new File(this.folder, fileName);

 try {
   outArchivo = new FileOutputStream(file);

 }
 catch (IOException e) {
   return;
 }


 try {
   outArchivo = new GZIPOutputStream(outArchivo);
 }
 catch (IOException e) {
   try {
     outArchivo.close();
   }
   catch (IOException e2) {
   }
   return;
 }      

 saveStrings(outArchivo,textLines);

 try {
   outArchivo.close();
 }
 catch (IOException e) {
   return;
 }
}




Re: How to use gzipOutput() ?
Reply #2 - Oct 1st, 2005, 10:06am
 
Muchos Gracias owd,
Your example couldn't be more clear.
Thx.
Re: How to use gzipOutput() ?
Reply #3 - Nov 12th, 2006, 5:26am
 
Is there a way to use GZIPOutputStream directed to a PHP Post?

I would like to upload data from an applet to server. Since the data is highly compressible, I'm thinking using gzWrite to send to a PHP script via POST.

I'm not that good with PHP, maybe someone have a better solution for APPLET>PHP SCRIPT dialogue.
Page Index Toggle Pages: 1