mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-11 00:23:42 -04:00
deprecate some input stream methods
Ported to kutil 1.26
This commit is contained in:
parent
58989aed8e
commit
94954657ca
@ -72,6 +72,7 @@ object FileUtil {
|
||||
throw IOException("Can not find temporary file after ${AssetsOptions.MAX_FILE_CHECKING} tries!")
|
||||
}
|
||||
|
||||
@Deprecated("kutil 1.26")
|
||||
fun InputStream.copy(vararg output: OutputStream, digest: MessageDigest?) {
|
||||
val buffer = ByteArray(BufferDefinition.DEFAULT_BUFFER_SIZE)
|
||||
|
||||
|
@ -18,6 +18,7 @@ import com.fasterxml.jackson.databind.ObjectReader
|
||||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import de.bixilon.kutil.buffer.BufferDefinition
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.exception.ExceptionUtil.ignoreAll
|
||||
import de.bixilon.kutil.json.JsonObject
|
||||
import de.bixilon.mbf.MBFBinaryReader
|
||||
import de.bixilon.minosoft.util.json.Jackson
|
||||
@ -27,6 +28,7 @@ import java.util.zip.ZipInputStream
|
||||
|
||||
object InputStreamUtil {
|
||||
|
||||
@Deprecated("kutil 1.26")
|
||||
fun InputStream.readAsString(close: Boolean = true): String {
|
||||
val builder = StringBuilder()
|
||||
|
||||
@ -89,7 +91,7 @@ object InputStreamUtil {
|
||||
content[entry.name] = stream.readAll()
|
||||
}
|
||||
// TODO: handle exception
|
||||
if (close) close()
|
||||
if (close) ignoreAll { close() }
|
||||
return content
|
||||
}
|
||||
|
||||
@ -101,7 +103,7 @@ object InputStreamUtil {
|
||||
content[entry.name] = stream.readAll()
|
||||
}
|
||||
// TODO: handle exception
|
||||
if (close) close()
|
||||
if (close) ignoreAll { close() }
|
||||
return content
|
||||
}
|
||||
|
||||
@ -109,6 +111,7 @@ object InputStreamUtil {
|
||||
return this.use { MBFBinaryReader(this).readMBF().data.unsafeCast() }
|
||||
}
|
||||
|
||||
@Deprecated("kutil 1.26")
|
||||
fun InputStream.readAll(close: Boolean = true): ByteArray {
|
||||
if (close) {
|
||||
return use { readAllBytes() }
|
||||
|
Loading…
x
Reference in New Issue
Block a user