fixed performance bug

This commit is contained in:
Walter Oggioni
2020-05-01 00:45:04 +01:00
parent 7e08bd7505
commit 3c21a78e1a
4 changed files with 12 additions and 14 deletions

View File

@@ -3,8 +3,6 @@ package net.woggioni.jzstd
import com.beust.jcommander.JCommander
import com.beust.jcommander.Parameter
import org.slf4j.LoggerFactory
import java.io.BufferedInputStream
import java.io.BufferedOutputStream
import java.io.InputStream
import java.io.OutputStream
import java.nio.file.Files
@@ -32,7 +30,7 @@ object Cli {
var overwrite: Boolean = false,
@Parameter(names = arrayOf("-l", "--level"), description = "Set compression level")
var level: Int = 3,
var level: Int = 0,
@Parameter(names = arrayOf("-i", "--input"), description = "Set input file, defaults to stdin otherwise")
var input: String? = null,
@@ -110,7 +108,7 @@ object Cli {
else it
}
output.use { outputStream ->
val buffer = ByteArray(0x10000)
val buffer = ByteArray(0x1000)
while (true) {
val read = inputStream.read(buffer, 0, buffer.size)
if (read < 0) break