org.cip4.jdflib.util
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
- Author:
- Dr. Rainer Prosi, Heidelberger Druckmaschinen AG
class to manage a directory by removing the oldest files whenever a new file is created
The oldest file dies when the maximum number is reached
08.12.2008
- See Also:
- Serialized Form
| Methods inherited from class java.io.File |
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toURI, toURL |
BackupDirectory
public BackupDirectory(String pathname,
int nBackupp)
- Parameters:
pathname - the DirectorynBackupp - 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 filenBackupp - the number of backups to retain
- Throws:
IllegalArgumentException - if file exists and is not a directory
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
getNewFile
public File getNewFile(String fileName)
- Parameters:
fileName -
- Returns:
toString
public String toString()
- Overrides:
toString in class File
- See Also:
File.toString()
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:
IPersistable.persist()
Copyright © 2013. All Rights Reserved.