List of utility methods to do Zip File Create
void | zipIt(File zipFile, ArrayList Zips all files specified in an ArrayList into a given file byte[] buffer = new byte[1024]; FileOutputStream fos = new FileOutputStream(zipFile); ZipOutputStream zos = new ZipOutputStream(fos); assert context.getFilesDir() != null; for (File file : files) { ZipEntry ze = new ZipEntry(file.getName()); zos.putNextEntry(ze); FileInputStream in = new FileInputStream(file); ... |
void | ZipFiles(File zip, File... srcFiles) Zip Files ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zip)); ZipFiles(out, "backup", srcFiles); out.close(); |
void | createZip(String[] files, String zipFile) create Zip try { FileOutputStream dest = new FileOutputStream(zipFile); ZipOutputStream out = new ZipOutputStream( new BufferedOutputStream(dest)); for (String s : files) { File file = new File(s); if (file.isDirectory()) { zipSubFolder(out, file, file.getParent().length()); ... |
void | createZip(String[] files, String zipFile) create Zip try { FileOutputStream dest = new FileOutputStream(zipFile); ZipOutputStream out = new ZipOutputStream( new BufferedOutputStream(dest)); for (String s : files) { File file = new File(s); if (file.isDirectory()) { zipSubFolder(out, file, file.getParent().length()); ... |
void | compress(File file) compress compress(file, true); |
void | compress(File file) compress compress(file, true); |
void | compress(File file, boolean delete) compress FileInputStream fis = new FileInputStream(file); FileOutputStream fos = new FileOutputStream(file.getPath() + EXT); compress(fis, fos); fis.close(); fos.flush(); fos.close(); if (delete) { file.delete(); ... |
void | compress(File file, boolean delete) compress FileInputStream fis = new FileInputStream(file); FileOutputStream fos = new FileOutputStream(file.getPath() + EXT); compress(fis, fos); fis.close(); fos.flush(); fos.close(); if (delete) { file.delete(); ... |
void | compressToFile(File dest, String str) compress To File if (str == null) { return; GZIPOutputStream zipOut = null; try { zipOut = new GZIPOutputStream(new FileOutputStream(dest)); zipOut.write(str.getBytes()); } finally { ... |