List of utility methods to do ZipOutputStream Write
void | zipRecursively(String path, File dir, ZipOutputStream out) zip Recursively for (File f : dir.listFiles()) { writeFileToZipStream(path, f, out); if (f.isDirectory()) { zipRecursively(path + "/" + f.getName() + "/", f, out); |
void | zipStoreBuffer(ZipOutputStream zip, String name, byte[] dataBuffer) zip Store Buffer ZipEntry zipEntry = new ZipEntry(name != null ? name : UUID.randomUUID().toString()); zipEntry.setMethod(ZipOutputStream.STORED); zipEntry.setSize(dataBuffer.length); CRC32 crc32 = new CRC32(); crc32.update(dataBuffer); zipEntry.setCrc(crc32.getValue()); try { zip.putNextEntry(zipEntry); ... |
void | zipToStream(File file, int prefixLength, ZipOutputStream out) zip To Stream String name; if (file.getAbsolutePath().length() < prefixLength) { name = ""; } else { name = file.getAbsolutePath().substring(prefixLength); if (name.isEmpty() && file.isFile()) { return; ... |