Skip to content

Instantly share code, notes, and snippets.

@BaptisteGarcin
BaptisteGarcin / GZIPUtils.kt
Created December 11, 2020 14:57
InputStream to .zip in kotlin (GZIPInputStream, GZIPOutputStream + PipedInputStream, PipedOutputStream)
// Inspired from https://gist.github.com/xis19/41999145269e4aa398aa354e129e507c
// Use externally with GzipUtils.compress(yourInputStream)
@Component
object GzipUtils {
private const val BUFFER_SIZE_BYTES = 512 * 1024
private val gzipExecutor = Executors.newCachedThreadPool(CustomizableThreadFactory("gzip-thread-"))
@Volatile
private var isShuttingDown = false