added cli tool
This commit is contained in:
22
cli/src/test/kotlin/InsaneTest.kt
Normal file
22
cli/src/test/kotlin/InsaneTest.kt
Normal file
@@ -0,0 +1,22 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user