Java Utililty Methods ZipOutputStream Write

List of utility methods to do ZipOutputStream Write

Description

The list of methods to do ZipOutputStream Write are organized into topic(s).

Method

voidzipRecursively(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);
voidzipStoreBuffer(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);
...
voidzipToStream(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;
...