public String calculateVersionFrom(@NotNull File file){
        Objects.requireNonNull(file, "file argument cannot be null");
        //optimise by store hash against file modified time, on subsequent calls, check file modified time first to determine file and time is present and return previous data.
        final long lastModified = file.lastModified();
        final String key = file.getAbsolutePath() + lastModified;
        final String storedHashValue = fixedSizeCache.get(key);
        if(!StringUtils.isEmpty(storedHashValue)){
            return storedHashValue;
        }
        final String digestHex;
        try {
            digestHex = getHashFromBytes(Files.readAllBytes(file.toPath()));
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
        fixedSizeCache.put(key, digestHex);
        return digestHex;
    }
public String calculateVersionFrom ( @ NotNull File file ) { Objects . requireNonNull ( file , "file argument cannot be null" ) ; final long lastModified = file . lastModified ( ) ; final String key = file . getAbsolutePath ( ) + lastModified ; final String storedHashValue = fixedSizeCache . get ( key ) ; if ( ! StringUtils . isEmpty ( storedHashValue ) ) { return storedHashValue ; } final String digestHex ; try { digestHex = getHashFromBytes ( Files . readAllBytes ( file . toPath ( ) ) ) ; } catch ( IOException e ) { throw new IllegalStateException ( e ) ; } fixedSizeCache . put ( key , digestHex ) ; return digestHex ; }
Gets md5 hashcode from file
@param file
@return