From 69513bf24613d4ba540bcdeaffe04dc9330a65a4 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 22 Sep 2024 23:45:14 +0530 Subject: refactor: use `Closeable#use` extension where applicable --- .../java/app/passwordstore/util/services/PasswordExportService.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'app') 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) } } } } } -- cgit v1.2.3