3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-30 23:02:15 +00:00

Close the temporary FileInputStream created in Sha256Hash.hashFileContents. Updates issue 265.

This commit is contained in:
Mike Hearn 2013-01-04 17:38:05 +01:00
parent 44865a3c50
commit 12a652bd1e

View File

@ -73,8 +73,12 @@ public class Sha256Hash implements Serializable {
* @throws IOException
*/
public static Sha256Hash hashFileContents(File f) throws IOException {
// Lame implementation that just reads the entire file into RAM. Can be made more efficient later.
return create(ByteStreams.toByteArray(new FileInputStream(f)));
FileInputStream in = new FileInputStream(f);
try {
return create(ByteStreams.toByteArray(in));
} finally {
in.close();
}
}
/**