Class MD5SumWatcher


  • public class MD5SumWatcher
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      MD5SumWatcher​(java.io.File watchedFile)
      Create a new MD5SumWatcher instance
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getSum()
      Get the current MD5 sum of the watched file
      boolean update()
      Detect if the file's MD5 has changed and track its new sum if so
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MD5SumWatcher

        public MD5SumWatcher​(java.io.File watchedFile)
        Create a new MD5SumWatcher instance
        Parameters:
        watchedFile - the file to watch
    • Method Detail

      • getSum

        public byte[] getSum()
                      throws java.io.FileNotFoundException,
                             java.io.IOException
        Get the current MD5 sum of the watched file
        Returns:
        a byte array of the MD5 sum
        Throws:
        java.io.FileNotFoundException - if the watched file does not exist
        java.io.IOException - if the file cannot be read
      • update

        public boolean update()
                       throws java.io.FileNotFoundException,
                              java.io.IOException
        Detect if the file's MD5 has changed and track its new sum if so
        Returns:
        if the file's MD5 has changed since the last update
        Throws:
        java.io.FileNotFoundException - if the watched file does not exist
        java.io.IOException - if the file cannot be read