com.github.jengelman.gradle.plugins.shadow.internal.DefaultZipCompressor.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shadow-gradle-plugin Show documentation
Show all versions of shadow-gradle-plugin Show documentation
Gradle plugin to create fat/uber JARs, apply file transforms, and relocate packages for applications and libraries. Gradle version of Maven's Shade plugin.
package com.github.jengelman.gradle.plugins.shadow.internal
import java.io.File
import org.apache.tools.zip.Zip64Mode
import org.apache.tools.zip.ZipOutputStream
import org.gradle.api.UncheckedIOException
internal class DefaultZipCompressor(
allowZip64Mode: Boolean,
private val entryCompressionMethod: Int,
) : ZipCompressor {
private val zip64Mode = if (allowZip64Mode) Zip64Mode.AsNeeded else Zip64Mode.Never
override fun createArchiveOutputStream(destination: File): ZipOutputStream {
try {
return ZipOutputStream(destination).apply {
setUseZip64(zip64Mode)
setMethod(entryCompressionMethod)
}
} catch (e: Exception) {
throw UncheckedIOException("Unable to create ZIP output stream for file $destination.", e)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy