org.cip4.jdflib.util.file
Class RollingFile

java.lang.Object
  extended by java.io.File
      extended by org.cip4.jdflib.util.file.RollingFile
All Implemented Interfaces:
Serializable, Comparable<File>
Direct Known Subclasses:
RollingDateFile

public class RollingFile
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
protected  org.apache.commons.logging.Log log
           
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
RollingFile(String pathname, String baseName)
           
 
Method Summary
protected  void calcPos()
           
protected  String getFileExpression()
           
 File getNewFile()
           
protected  String getNewFileName()
           
 File[] readAll()
          read all matching files from this
 void setDigits(int digits)
           
 
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
 

Field Detail

log

protected final org.apache.commons.logging.Log log
Constructor Detail

RollingFile

public RollingFile(String pathname,
                   String baseName)
Parameters:
pathname - the base filename
baseName - the name of the base file,
if a filename with double "." , e.g. xxx..txt is specified, the algorithm will generate names such as xxx.000001.txt,
if a single "." e.g. xxx.txt is specified, the algorithm will generate names such as xxx000001.txt,
Method Detail

calcPos

protected void calcPos()

readAll

public File[] readAll()
read all matching files from this

Returns:
array of all matching files

getFileExpression

protected String getFileExpression()
Returns:

getNewFile

public File getNewFile()
Returns:
the file to write, null if error occurred

getNewFileName

protected String getNewFileName()
Returns:
the file to write, i.e. this

setDigits

public void setDigits(int digits)
Parameters:
digits - the digits to set


Copyright © 2013. All Rights Reserved.