From 0553cce3103183db85e35a30fc17b9298ca429df Mon Sep 17 00:00:00 2001 From: Robinson Date: Sun, 6 Aug 2023 17:36:13 -0600 Subject: [PATCH] Moved LZ4 to its own class to male LZ4 optional --- src/dorkbox/bytes/LZ4Util.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/dorkbox/bytes/LZ4Util.kt b/src/dorkbox/bytes/LZ4Util.kt index 93f8a93..c536387 100644 --- a/src/dorkbox/bytes/LZ4Util.kt +++ b/src/dorkbox/bytes/LZ4Util.kt @@ -24,6 +24,17 @@ import java.io.InputStream import java.security.NoSuchAlgorithmException object LZ4Util { + init { + try { + Class.forName("net.jpountz.xxhash.XXHashFactory") + } + catch (e: Exception) { + System.err.println("Please add the LZMA library to your classpath, for example: implementation(\"org.lz4:lz4-java:1.8.0\")") + throw e + } + + } + private val xxHashFactory: ThreadLocal by lazy { ThreadLocal.withInitial { try {