Files
jzstd/cli/src/test/kotlin/InsaneTest.kt
2020-04-27 19:41:40 +01:00

22 lines
705 B
Kotlin

import net.woggioni.jzstd.ZstdOutputStream
import org.junit.jupiter.api.Test
import java.nio.file.Files
import java.nio.file.Paths
class InsaneTest {
@Test
fun test2() {
val inputFile = Paths.get("/tmp/Richard_Dawkins_The_Selfish_Gene.pdf")
Files.newInputStream(inputFile).use { `is` ->
ZstdOutputStream.from(Files.newOutputStream(Paths.get("/tmp/Richard_Dawkins_The_Selfish_Gene.pdf.zst"))).use { os ->
val buffer = ByteArray(0x10000)
while (true) {
val read = `is`.read(buffer)
if (read < 0) break
os.write(buffer, 0, read)
}
}
}
}
}