Class BackupDirectory

java.lang.Object
java.io.File
org.cip4.jdflib.util.BackupDirectory
All Implemented Interfaces:
Serializable, Comparable<File>, IPersistable
Direct Known Subclasses:
RollingBackupDirectory

public class BackupDirectory extends File implements IPersistable
See Also:
  • Constructor Details

    • BackupDirectory

      public BackupDirectory(String pathname, int nBackupp)
      Parameters:
      pathname - the Directory
      nBackupp - the number of backups to retain
      Throws:
      IllegalArgumentException - if file exists and is not a directory
    • BackupDirectory

      public BackupDirectory(File file, int nBackupp) throws IllegalArgumentException
      Parameters:
      file - the base file
      nBackupp - the number of backups to retain
      Throws:
      IllegalArgumentException - if file exists and is not a directory
  • Method Details

    • getNewFile

      public File getNewFile(File localFile)
      creates a new file in this and assures than no more than nBackup files remain
      Parameters:
      localFile - the local file to place in this directory
      Returns:
      the file to write, null if an io exception occurred when creating it
    • clean

      public void clean()
    • getNewFile

      public File getNewFile(String fileName)
      Parameters:
      fileName -
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class File
      See Also:
    • persist

      public boolean persist()
      Description copied from interface: IPersistable
      physically persist the whatever stuff
      Specified by:
      persist in interface IPersistable
      Returns:
      true if persist was successful
      See Also:
    • isCreateDirectory

      public boolean isCreateDirectory()
    • setDirectory

      public void setDirectory(boolean isDirectory)