while (it.hasNext()) { try { file = (File) it.next(); File zipped = new File(file.getAbsolutePath() + ".gz"); GZIPOutputStream zip = new GZIPOutputStream(new FileOutputStream(zipped)); BufferedInputStream in = new BufferedInputStream(new FileInputStream(file)); byte[] b = new byte[BUFFER_SIZE]; int len = 0;
while (it.hasNext()) { try { file = (File) it.next(); File zipped = new File(file.getAbsolutePath() + ".gz"); GZIPOutputStream zip = new GZIPOutputStream(new FileOutputStream(zipped)); BufferedInputStream in = new BufferedInputStream(new FileInputStream(file)); byte[] b = new byte[BUFFER_SIZE]; int len;
         public void run() {             Iterator it = files.iterator();             File file = null;             while (it.hasNext()) {                 try {                     file = (File) it.next();                     File zipped = new File(file.getAbsolutePath() + ".gz");                     GZIPOutputStream zip = new GZIPOutputStream(new FileOutputStream(zipped));                     BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));                     byte[] b = new byte[BUFFER_SIZE];                     int len = 0;                     while ((len = in.read(b, 0, BUFFER_SIZE)) != -1) {                         zip.write(b, 0, len);                     }                     zip.close();                     in.close();                     file.delete();                 } catch (Exception e) {                     System.err.println("Error gzipping " + file);                     System.err.println(e.toString());                 }             }         }