Package org.cip4.jdflib.util
Class BackupDirectory
- java.lang.Object
-
- java.io.File
-
- org.cip4.jdflib.util.BackupDirectory
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<java.io.File>,IPersistable
- Direct Known Subclasses:
RollingBackupDirectory
public class BackupDirectory extends java.io.File implements IPersistable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BackupDirectory(java.io.File file, int nBackupp)BackupDirectory(java.lang.String pathname, int nBackupp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.FilegetNewFile(java.io.File localFile)creates a new file in this and assures than no more than nBackup files remainjava.io.FilegetNewFile(java.lang.String fileName)booleanisCreateDirectory()booleanpersist()physically persist the whatever stuffvoidsetDirectory(boolean isDirectory)java.lang.StringtoString()-
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, toPath, toURI, toURL
-
-
-
-
Constructor Detail
-
BackupDirectory
public BackupDirectory(java.lang.String pathname, int nBackupp)- Parameters:
pathname- the DirectorynBackupp- the number of backups to retain- Throws:
java.lang.IllegalArgumentException- if file exists and is not a directory
-
BackupDirectory
public BackupDirectory(java.io.File file, int nBackupp) throws java.lang.IllegalArgumentException- Parameters:
file- the base filenBackupp- the number of backups to retain- Throws:
java.lang.IllegalArgumentException- if file exists and is not a directory
-
-
Method Detail
-
getNewFile
public java.io.File getNewFile(java.io.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 java.io.File getNewFile(java.lang.String fileName)
- Parameters:
fileName-- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.io.File- See Also:
File.toString()
-
persist
public boolean persist()
Description copied from interface:IPersistablephysically persist the whatever stuff- Specified by:
persistin interfaceIPersistable- Returns:
- true if persist was successful
- See Also:
IPersistable.persist()
-
isCreateDirectory
public boolean isCreateDirectory()
-
setDirectory
public void setDirectory(boolean isDirectory)
-
-