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

com.jtransc.io.zip.kt Maven / Gradle / Ivy

package com.jtransc.io

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

fun createZipFile(files: Map): ByteArray {
	val baos = ByteArrayOutputStream()
	val out = ZipOutputStream(baos);

	for ((name, content) in files) {
		val entry = ZipEntry(name)
		out.putNextEntry(entry);
		out.write(content)
		out.closeEntry()
	}

	out.close()

	return baos.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy