Class FileBackup


  • public class FileBackup
    extends java.lang.Object
    Handles backup generation for files.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_BACKUP_LEVEL
      this is normally a bad idea, but we allow this global
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.io.File create​(java.io.File file)
      Returns the new backup file for the given file.
      static java.io.File create​(java.io.File file, int backuplevel)
      Returns the new backup file for the given file and backup level
      static java.io.File create​(java.io.File file, java.io.File directory)
      Returns the new backup file for the given file.
      static java.io.File create​(java.io.File file, java.io.File directory, int backupLevel)
      Returns the new backup file for the given file.
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_BACKUP_LEVEL

        public static int DEFAULT_BACKUP_LEVEL
        this is normally a bad idea, but we allow this global
    • Method Detail

      • create

        public static java.io.File create​(java.io.File file)
                                   throws java.io.IOException
        Returns the new backup file for the given file. Uses a backup level of 2.
        Parameters:
        file - the file to back up. The directory is the parent directory of the given file.
        Returns:
        the created backup file.
        Throws:
        java.io.IOException - if the file cannot be created
      • create

        public static java.io.File create​(java.io.File file,
                                          int backuplevel)
                                   throws java.io.IOException
        Returns the new backup file for the given file and backup level
        Parameters:
        file - the file to back up. The directory is the parent directory of the given file.
        backuplevel - number of revisions to hold, ignored for the SIMPLE backup type.
        Returns:
        the created backup file.
        Throws:
        java.io.IOException - if the file cannot be created
      • create

        public static java.io.File create​(java.io.File file,
                                          java.io.File directory)
                                   throws java.io.IOException
        Returns the new backup file for the given file. Uses a backup level of 2.
        Parameters:
        file - the file to back up.
        directory - the directory to copy the backup to. If the directory doesn't exist, it will be created.
        Returns:
        the created backup file.
        Throws:
        java.io.IOException - if the file cannot be created
      • create

        public static java.io.File create​(java.io.File file,
                                          java.io.File directory,
                                          int backupLevel)
                                   throws java.io.IOException
        Returns the new backup file for the given file.
        Parameters:
        file - the file to back up.
        directory - the directory to copy the backup to. If the directory doesn't exist, it will be created.
        backupLevel - number of revisions to hold, ignored for the SIMPLE backup type.
        Returns:
        the created backup file or null if target file does not exist
        Throws:
        java.io.IOException - if the file cannot be created