From 63ec856e875e038056858edf5803b2e61b0977de Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 11 Oct 2021 11:13:56 +0200 Subject: [PATCH] improve transaction file opening io --- src/main/java/com/sparrowwallet/sparrow/AppController.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/AppController.java b/src/main/java/com/sparrowwallet/sparrow/AppController.java index 01797d0b..e14bbd18 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppController.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppController.java @@ -69,6 +69,7 @@ import org.slf4j.LoggerFactory; import java.io.*; import java.net.URL; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.text.ParseException; import java.util.*; import java.util.stream.Collectors; @@ -454,10 +455,7 @@ public class AppController implements Initializable { if(file.exists()) { try { - byte[] bytes = new byte[(int)file.length()]; - FileInputStream stream = new FileInputStream(file); - stream.read(bytes); - stream.close(); + byte[] bytes = Files.readAllBytes(file.toPath()); String name = file.getName(); try {