org.cip4.jdflib.util
Class RollingBackupFile

java.lang.Object
  extended by java.io.File
      extended by org.cip4.jdflib.util.RollingBackupFile
All Implemented Interfaces:
Serializable, Comparable<File>

public class RollingBackupFile
extends File

Author:
Dr. Rainer Prosi, Heidelberger Druckmaschinen AG class to generate rolling backup files using a simple .n naming algorithm. The oldest file dies when the maximum number is reached 08.12.2008
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
RollingBackupFile(File file, int nBackupp)
           
RollingBackupFile(String pathname, int nBackupp)
           
 
Method Summary
 void clearAll()
          remove all files, including main file
 File getNewFile()
           
 File getNewFile(String extension)
          get a new file for a given extension
 File getOldFile(int i)
           
 
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, toString, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RollingBackupFile

public RollingBackupFile(String pathname,
                         int nBackupp)
Parameters:
pathname - the base filename
nBackupp - the number of backups to retain

RollingBackupFile

public RollingBackupFile(File file,
                         int nBackupp)
Parameters:
file - the base file
nBackupp - the number of backups to retain
Method Detail

getNewFile

public File getNewFile()
Returns:
the file to write, i.e. this

getNewFile

public File getNewFile(String extension)
get a new file for a given extension

Parameters:
extension -
Returns:

getOldFile

public File getOldFile(int i)
Parameters:
i - the index of the file to read
Returns:
the file to read, with backup

clearAll

public void clearAll()
remove all files, including main file



Copyright © 2013. All Rights Reserved.