From 02bc52037e9ccccca672d6156d9c325c74fe28b3 Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Mon, 1 Jul 2024 17:27:48 -0400 Subject: Update a whole bunch of things Yeah... not a great commit message. t.b.h, I could maybe've split the commit into more parts; but that would be quite a lot off effort and would have a pretty decent chance of at least one of the commits leaving the repository in a non-working state. For the future, will want to try and commit more often so there aren't these mega-commits where it's just "a whole bunch of stuff changed" --- .../src/main/java/net/wotonomy/foundation/NSData.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSData.java') diff --git a/projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSData.java b/projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSData.java index 67f1d59..3120ad3 100644 --- a/projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSData.java +++ b/projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSData.java @@ -20,6 +20,7 @@ package net.wotonomy.foundation; import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -75,8 +76,8 @@ public class NSData { public NSData(File aFile) { int len = (int) aFile.length(); byte[] data = new byte[len]; - try { - new java.io.FileInputStream(aFile).read(data); + try (FileInputStream fis = new java.io.FileInputStream(aFile)) { + fis.read(data); } catch (Exception exc) { // produce an empty or partially blank array } @@ -189,6 +190,7 @@ public class NSData { return bytes(0, length()); } + @Override public String toString() { String hex = "0123456789ABCDEF"; StringBuffer buf = new StringBuffer(); -- cgit v1.2.3