code: public FileDigestOutputStream openFile(File file) throws IOException
     {
        MessageDigest md;
        try
        {
           md = MessageDigest.getInstance(digestAlgo);
        }
        catch (NoSuchAlgorithmException e)
        {
           LOG.error("Can't wriet using " + digestAlgo + " algorithm, " + e, e);
           throw new IOException(e.getMessage(), e);
        }
  
        return new FileDigestOutputStream(file, md);
     }
docs: Open digester output.<br> Digester output will write into given file and calc hash for a
  content.
  
  @param file
  - destenation file
  @return - digester output stream
  @throws IOException