mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 17:43:06 +02:00
Cleanup: use try-with-resources.
This commit is contained in:
@@ -189,16 +189,10 @@ public class FileUtils {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a File (src) to a File (dst).
|
||||
*
|
||||
* @param src source file.
|
||||
* @param dst destination file.
|
||||
*/
|
||||
public static void copy(FileDescriptor src, File dst) {
|
||||
try (FileChannel in = new FileInputStream(src).getChannel();
|
||||
FileChannel out = new FileOutputStream(dst).getChannel()) {
|
||||
in.transferTo(0, in.size(), out);
|
||||
try (FileInputStream in = new FileInputStream(src);
|
||||
FileOutputStream out = new FileOutputStream(dst)) {
|
||||
in.getChannel().transferTo(0, in.getChannel().size(), out.getChannel());
|
||||
} catch (Exception e) {
|
||||
// post to log
|
||||
Log.e(TAG, e.getMessage());
|
||||
|
||||
Reference in New Issue
Block a user