mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-27 05:04:17 +01:00
Close InputStream
after usage in KeyReader
The `InputStream` would not be closed after reading the key file in `KeyReader#import`, it's now wrapped with `use{ }` which handles closing the stream after usage.
This commit is contained in:
parent
647cb07dc8
commit
1d070e6332
@ -47,7 +47,7 @@ object KeyReader {
|
|||||||
|
|
||||||
val tmpOutputFile = File("${context.filesDir.canonicalFile}/${keyType.fileName}.tmp")
|
val tmpOutputFile = File("${context.filesDir.canonicalFile}/${keyType.fileName}.tmp")
|
||||||
|
|
||||||
val inputStream = context.contentResolver.openInputStream(uri)
|
context.contentResolver.openInputStream(uri).use { inputStream ->
|
||||||
tmpOutputFile.bufferedWriter().use { writer ->
|
tmpOutputFile.bufferedWriter().use { writer ->
|
||||||
val valid = inputStream!!.bufferedReader().useLines {
|
val valid = inputStream!!.bufferedReader().useLines {
|
||||||
for (line in it) {
|
for (line in it) {
|
||||||
@ -83,6 +83,7 @@ object KeyReader {
|
|||||||
return valid
|
return valid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun isHexString(str : String) : Boolean {
|
private fun isHexString(str : String) : Boolean {
|
||||||
for (c in str)
|
for (c in str)
|
||||||
|
Loading…
Reference in New Issue
Block a user