public static void compressTGZ(Resource[] sources,Resource target,int mode) throws IOException {
  File tmpTarget=File.createTempFile("_temp","tmp");
  try {
    OutputStream tmpOs=new FileOutputStream(tmpTarget);
    try {
      compressTar(sources,tmpOs,mode);
    }
  finally {
      IOUtil.closeEL(tmpOs);
    }
    InputStream is=null;
    OutputStream os=null;
    try {
      is=new FileInputStream(tmpTarget);
      os=target.getOutputStream();
      compressGZip(is,os);
    }
  finally {
      IOUtil.closeEL(is,os);
    }
  }
  finally {
    tmpTarget.delete();
  }
}

public static void compressTGZ ( Resource [ ] sources , Resource target , int mode ) throws IOException { File tmpTarget = File . createTempFile ( "_temp" , "tmp" ) ; try { OutputStream tmpOs = new FileOutputStream ( tmpTarget ) ; try { compressTar ( sources , tmpOs , mode ) ; } finally { IOUtil . closeEL ( tmpOs ) ; } InputStream is = null ; OutputStream os = null ; try { is = new FileInputStream ( tmpTarget ) ; os = target . getOutputStream ( ) ; compressGZip ( is , os ) ; } finally { IOUtil . closeEL ( is , os ) ; } } finally { tmpTarget . delete ( ) ; } }
compress a source file / directory to a tar / gzip file
