public String createZipFile(String sourceDir) throws IOException { String zipFile = getZipFileName(sourceDir); boolean zipDone = false; try { //create object of FileOutputStream FileOutputStream fout = new FileOutputStream(zipFile); //create object of ZipOutputStream from FileOutputStream ZipOutputStream zout = new ZipOutputStream(fout); //create File object from source directory File fileSource = new File(sourceDir); zipDone = addDirectory(zout, fileSource); //close the ZipOutputStream zout.close(); } catch (IOException ioe) { Logger.getAnonymousLogger().log(Level.SEVERE, "Error while creating zip file :", ioe); throw ioe; } return zipFile; }
public String createZipFile(String sourceDir, String zipFileName) throws IOException { ZipOutputStream zout = null; String zipFile = getZipFileName(sourceDir, zipFileName); try { //create object of FileOutputStream FileOutputStream fout = new FileOutputStream(zipFile); //create object of ZipOutputStream from FileOutputStream zout = new ZipOutputStream(fout); //create File object from source directory File fileSource = new File(sourceDir); addDirectory(zout, fileSource, fileSource.getAbsolutePath().length() + 1); //close the ZipOutputStream zout.close(); } catch (IOException ioe) { Logger.getAnonymousLogger().log(Level.SEVERE, "Error while creating zip file :", ioe); throw ioe; } finally { safeCloseStream(zout); } return zipFile; }
public String createZipFile(String sourceDir) throws IOException { ZipOutputStream zout = null; String zipFile = getZipFileName(sourceDir); try { //create object of FileOutputStream FileOutputStream fout = new FileOutputStream(zipFile); //create object of ZipOutputStream from FileOutputStream zout = new ZipOutputStream(fout); //create File object from source directory File fileSource = new File(sourceDir); addDirectory(zout, fileSource, fileSource.getAbsolutePath().length() + 1); //close the ZipOutputStream zout.close(); } catch (IOException ioe) { Logger.getAnonymousLogger().log(Level.SEVERE, "Error while creating zip file :", ioe); throw ioe; } finally { safeCloseStream(zout); } return zipFile; }
public String createZipFile(String sourceDir, String zipFileName) throws IOException { ZipOutputStream zout = null; String zipFile = getZipFileName(sourceDir, zipFileName); try { //create object of FileOutputStream FileOutputStream fout = new FileOutputStream(zipFile); //create object of ZipOutputStream from FileOutputStream zout = new ZipOutputStream(fout); //create File object from source directory File fileSource = new File(sourceDir); addDirectory(zout, fileSource, fileSource.getAbsolutePath().length() + 1); //close the ZipOutputStream zout.close(); } catch (IOException ioe) { Logger.getAnonymousLogger().log(Level.SEVERE, "Error while creating zip file :", ioe); throw ioe; } finally { safeCloseStream(zout); } return zipFile; }
public String createZipFile(String sourceDir) throws IOException { ZipOutputStream zout = null; String zipFile = getZipFileName(sourceDir); try { //create object of FileOutputStream FileOutputStream fout = new FileOutputStream(zipFile); //create object of ZipOutputStream from FileOutputStream zout = new ZipOutputStream(fout); //create File object from source directory File fileSource = new File(sourceDir); addDirectory(zout, fileSource, fileSource.getAbsolutePath().length() + 1); //close the ZipOutputStream zout.close(); } catch (IOException ioe) { Logger.getAnonymousLogger().log(Level.SEVERE, "Error while creating zip file :", ioe); throw ioe; } finally { safeCloseStream(zout); } return zipFile; }