mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 06:44:16 +00:00
Close the temporary FileInputStream created in Sha256Hash.hashFileContents. Updates issue 265.
This commit is contained in:
parent
44865a3c50
commit
12a652bd1e
@ -73,8 +73,12 @@ public class Sha256Hash implements Serializable {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static Sha256Hash hashFileContents(File f) 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.
|
FileInputStream in = new FileInputStream(f);
|
||||||
return create(ByteStreams.toByteArray(new FileInputStream(f)));
|
try {
|
||||||
|
return create(ByteStreams.toByteArray(in));
|
||||||
|
} finally {
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user