List of utility methods to do Zip File
void | zipFile(File file, File output) Create a ZIP archive of a file try { FileOutputStream fos = new FileOutputStream(output); ZipOutputStream zos = new ZipOutputStream(fos); ZipEntry ze = new ZipEntry(file.getName()); zos.putNextEntry(ze); FileInputStream in = new FileInputStream(file); byte[] buffer = new byte[1024]; int len; ... |
void | zipFile(File file, File zipFile) zip File byte[] buffer = new byte[8192]; int read = 0; ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)); FileInputStream fis = new FileInputStream(file); zos.putNextEntry(new ZipEntry(file.getName())); while ((read = fis.read(buffer)) > 0) { zos.write(buffer, 0, read); fis.close(); zos.closeEntry(); zos.close(); |
void | zipFile(File file, String zipFile) zip File ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)); ZipEntry ze = null; byte[] buf = new byte[1024]; int readLen = 0; ze = new ZipEntry(file.getName()); ze.setSize(file.length()); ze.setTime(file.lastModified()); zos.putNextEntry(ze); ... |
void | zipFile(File fileToZip, String fileName, ZipOutputStream zipOut) zip File if (fileToZip.isHidden()) { return; if (fileToZip.isDirectory()) { File[] children = fileToZip.listFiles(); for (File childFile : children) { zipFile(childFile, fileName + "/" + childFile.getName(), zipOut); return; FileInputStream fis = new FileInputStream(fileToZip); ZipEntry zipEntry = new ZipEntry(fileName); zipOut.putNextEntry(zipEntry); byte[] bytes = new byte[1024]; int length; while ((length = fis.read(bytes)) >= 0) { zipOut.write(bytes, 0, length); fis.close(); |
void | zipFile(File input, File output) zip File FileInputStream in = null; ZipOutputStream out = null; try { in = new FileInputStream(input); out = new ZipOutputStream(new FileOutputStream(output)); out.putNextEntry(new ZipEntry(input.getName())); byte[] buffer = new byte[4096]; int bytesRead; ... |
void | zipFile(File inputFile, File outputZip) zip File byte[] buffer = new byte[1024]; try { FileOutputStream fos = new FileOutputStream(outputZip); ZipOutputStream zos = new ZipOutputStream(fos); ZipEntry ze = new ZipEntry(inputFile.getName()); zos.putNextEntry(ze); FileInputStream in = new FileInputStream(inputFile); int len; ... |
void | zipFile(File inputFile, String zipFilePath) zip File try { FileOutputStream fileOutputStream = new FileOutputStream(zipFilePath); ZipOutputStream zipOutputStream = new ZipOutputStream(fileOutputStream); ZipEntry zipEntry = new ZipEntry(inputFile.getName()); zipOutputStream.putNextEntry(zipEntry); FileInputStream fileInputStream = new FileInputStream(inputFile); byte[] buf = new byte[1024]; int bytesRead; ... |
void | zipFile(File resFile, ZipOutputStream zipout, String rootpath) zip File rootpath = rootpath + (rootpath.trim().length() == 0 ? "" : File.separator) + resFile.getName(); rootpath = new String(rootpath.getBytes("8859_1"), "GB2312"); if (resFile.isDirectory()) { File[] fileList = resFile.listFiles(); for (File file : fileList) { zipFile(file, zipout, rootpath); } else { ... |
void | zipFile(File root, String outFileFullName, String[] suffixs, String[] nameMatche, String[] nameNotMatche) zip File zipFile0(root, outFileFullName, getFileList(root, suffixs, nameMatche, nameNotMatche)); |
void | zipFile(File source, File dest) zip File FileInputStream in = new FileInputStream(source); BufferedInputStream in2 = new BufferedInputStream(in); FileOutputStream out = new FileOutputStream(dest); GZIPOutputStream zipOut = new GZIPOutputStream(out); BufferedOutputStream out2 = new BufferedOutputStream(zipOut); try { int chunk; while ((chunk = in2.read()) != -1) { ... |