commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bjarne Pedersen / Schmiedmann" <>
Subject Re: [commons-net ftp] how to ftp a zipped file and unzip it at the other end?
Date Wed, 16 Aug 2006 13:17:29 GMT
Hi Anil

I have this snippet (dont if it work, have not tryed it)


public class UnZip {
   final int BUFFER = 2048;
   public static void main (String argv[]) {
      try {
         BufferedOutputStream dest = null;
         FileInputStream fis = new
         ZipInputStream zis = new
	   ZipInputStream(new BufferedInputStream(fis));
         ZipEntry entry;
         while((entry = zis.getNextEntry()) != null) {
            System.out.println("Extracting: " +entry);
            int count;
            byte data[] = new byte[BUFFER];
            // write the files to the disk
            FileOutputStream fos = new
            dest = new
              BufferedOutputStream(fos, BUFFER);
            while ((count =, 0, BUFFER))
              != -1) {
               dest.write(data, 0, count);
      } catch(Exception e) {
Med venlig hilsen / Best regards / Mit freundlichen GrĂ¼ssen IT-Ansvarlig 
Bjarne Pedersen SCHMIEDMANN ODENSE Sandvadvej 9, Korup 5210 Odense NV Tlf. 
+45 65 94 15 45 Fax +45 65 94 00 98 E-Mail web CVR. Nr. DK20549548
----- Original Message ----- 
From: "Anil Philip" <>
To: <>
Sent: Wednesday, August 16, 2006 3:09 PM
Subject: [commons-net ftp] how to ftp a zipped file and unzip it at the 
other end?

I have an html file and its associated folder on a
Windows desktop. e.g. myPage.html and myPage_files. I
need to save it remotely to a Linux machine. So I use
ftp. However it is inefficient to transfer each file
across piecemeal.
I was thinking it might be smarter to zip it up and
ftp it across.
Qs. How do I unzip it at the other end?
(of course, this is done by my program, not manually).

for good news go to

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message