22 lines
705 B
Kotlin
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)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |