I want to create hash checksums of big files. Unfortunately Netbeans shows an error: "Exception in thread "Thread-3" java.lang.OutOfMemoryError: Required array size too large"
So I think, "byte[] byteStream = Files.readAllBytes( path );" is not working for this.
Can you tell me what is the best way to reach my goal?
My code so far:
for (Path path : ArrayOfFilePathes) {
byte[] byteStream = Files.readAllBytes( path );
if ( GUI.bMd5Selected == true ) {
checksume = "MD5";
string = DigestUtils.md5Hex( byteStream );
}else{
checksume = "Sha256";
string = DigestUtils.sha256Hex(byteStream);
}
Thank you!