Exception when calling : <p>I would like to ask a question for computing a hashvalue for a empty file. I need to compute a hash_value when the file f is first created and is empty. Then, at the end I will update the hash_value again. My code is not working for windows os. Can you tell me how to handle this? Thanks. </p>

<pre><code>            objectFile = File(fullFilePath);
            fileInputStream = FileInputStream(objectFile);
            data = IOUtils.toString(fileInputStream, 'UTF-8');

            persistent digest;            

            if isempty(digest)
                digest = MessageDigest.getInstance('SHA-256');
            end

            hash = digest.digest(java.lang.String(data).getBytes('UTF-8'));
</code></pre>

<p>Error Message</p>

<pre><code>    digest.digest(java.lang.String(data).getBytes('UTF-8'))
    Java exception occurred:
    java.lang.NullPointerException

        at java.security.MessageDigest.update(Unknown Source)

        at java.security.MessageDigest.digest(Unknown Source)
</code></pre>
