All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.airlift.airship.configbundler.ZipPackager Maven / Gradle / Ivy

There is a newer version: 0.13
Show newest version
package io.airlift.airship.configbundler;

import com.google.common.io.ByteStreams;
import com.google.common.io.InputSupplier;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

class ZipPackager
{
    public static void packageEntries(OutputStream output, Map> entries)
            throws IOException
    {
        ZipOutputStream out = new ZipOutputStream(output);

        for (Map.Entry> entry : entries.entrySet()) {
            String path = entry.getKey();
            ZipEntry fileEntry = new ZipEntry(path);
            out.putNextEntry(fileEntry);
            ByteStreams.copy(entry.getValue(), out);
        }
        out.finish();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy