Compare two file binaries in Mendix (or Java action)

I'm trying to create a method to compare two files. One that's already in the database and one that's uploaded by the current user. I need a way to compare them but not their size, I want to compare their binary information. So now I'm trying with a java action:                   OutputStream outputStreamOldDocument = new ByteArrayOutputStream();         OutputStream outputStreamNewDocument = new ByteArrayOutputStream();         this.OldDocument.getContents( getContext(), outputStreamOldDocument);         this.NewDocument.getContents(getContext(), outputStreamNewDocument); if (!outputStreamNewDocument.equals(outputStreamOldDocument) {             return true;         }         else {              return false;         } this always returns false Any ideas?
1 answers

See .

As this thread nicely points out, depending on the expected usage pattern of your logic, you might consider storing an md5 hash, and compare hashes as this would save you from having to retrieve the stored file form disk.