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

fr.insee.eno.utils.FileArchiver Maven / Gradle / Ivy

Go to download

Eno is a tool that generates survey questionnaires starting from their formal description in DDI

The newest version!
package fr.insee.eno.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

public class FileArchiver {
	
	private static final Logger LOGGER = LoggerFactory.getLogger(FileArchiver.class);

    public static void writeToZipOS(String zipEntryFileName, ByteArrayOutputStream fileStream, ZipOutputStream zipStream)
            throws IOException {
        LOGGER.info("Writing file : '"+zipEntryFileName+ "' to archive file.");

        ZipEntry zipEntry= new ZipEntry(zipEntryFileName);

        zipStream.putNextEntry(zipEntry);
        zipStream.write(fileStream.toByteArray());
        zipStream.closeEntry();
        fileStream.close();
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy