aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2024-09-22 23:45:14 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2024-09-22 23:51:55 +0530
commit69513bf24613d4ba540bcdeaffe04dc9330a65a4 (patch)
tree3652a618095ab1581cd3a28ea415b15f0c48d4ca /app
parent6a5e35a95c795e7c56048ac36d86da53c2799e4e (diff)
refactor: use `Closeable#use` extension where applicable
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/app/passwordstore/util/services/PasswordExportService.kt5
1 files changed, 1 insertions, 4 deletions
diff --git a/app/src/main/java/app/passwordstore/util/services/PasswordExportService.kt b/app/src/main/java/app/passwordstore/util/services/PasswordExportService.kt
index 854071f2..c74c3f0e 100644
--- a/app/src/main/java/app/passwordstore/util/services/PasswordExportService.kt
+++ b/app/src/main/java/app/passwordstore/util/services/PasswordExportService.kt
@@ -89,10 +89,7 @@ class PasswordExportService : Service() {
val destOutputStream = contentResolver.openOutputStream(targetPasswordFile.uri)
if (destOutputStream != null && sourceInputStream != null) {
- sourceInputStream.copyTo(destOutputStream, 1024)
-
- sourceInputStream.close()
- destOutputStream.close()
+ sourceInputStream.use { source -> destOutputStream.use { dest -> source.copyTo(dest) } }
}
}
}