[util-io][properties] close file stream after save property operation ends.
(cherry picked from commit f0ae971f9304ecd7a2ba134ab77b511a0569ed5f)
This commit is contained in:
@@ -28,7 +28,9 @@ fun File.saveProperties(properties: Properties) {
|
||||
}
|
||||
|
||||
// TODO: don't act like this
|
||||
outputStream().write(String(byteStream.toByteArray()).split("\n").drop(1).joinToString("\n").toByteArray())
|
||||
outputStream().use {
|
||||
it.write(String(byteStream.toByteArray()).split("\n").drop(1).joinToString("\n").toByteArray())
|
||||
}
|
||||
}
|
||||
|
||||
fun Properties.saveToFile(file: File) = file.saveProperties(this)
|
||||
|
||||
Reference in New Issue
Block a user