Skip to content
Snippets Groups Projects
Commit a387141f authored by Adrien Béraud's avatar Adrien Béraud
Browse files

file utils: use try-with-resources in copyFile

Change-Id: I8a89b98d393005816bfcdc09eb78b6178672c457
parent cb9a934f
Branches
Tags
No related merge requests found
...@@ -39,12 +39,9 @@ public class FileUtils { ...@@ -39,12 +39,9 @@ public class FileUtils {
} }
public static boolean copyFile(File src, File dest) { public static boolean copyFile(File src, File dest) {
try { try (InputStream inputStream = new FileInputStream(src);
InputStream inputStream = new FileInputStream(src); FileOutputStream outputStream = new FileOutputStream(dest)) {
FileOutputStream outputStream = new FileOutputStream(dest);
copyFile(inputStream, outputStream); copyFile(inputStream, outputStream);
inputStream.close();
outputStream.close();
} catch (IOException e) { } catch (IOException e) {
Log.w(TAG, "Can't copy file", e); Log.w(TAG, "Can't copy file", e);
return false; return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment