java.lang.Object
org.apache.jena.rdfpatch.filelog.rotate.FileMgr

public class FileMgr extends Object
  • Constructor Details

    • FileMgr

      public FileMgr()
  • Method Details

    • freshFilename

      public static Path freshFilename(Path directory, String filename)
    • freshFilename

      public static Path freshFilename(Path directory, String filename, int startingFrom, String sep, String format)
      Find a unique file name, assumes that it will not take too many probes. Conceptually, ".0" is the base filename. This function does not create the file. Returns the full file name, directory included.
      Parameters:
      directory - Directory to look in
      filename - Base file name, without index modifer
      startingFrom - Begin probing at index
      format - String format of the number as modifier e.g. "%03d"
    • scan

      public static <X> List<Filename> scan(Path directory, String namebase, Pattern pattern)
      Find files matching a pattern. The pattern has groups:
      • 1 : the base filename.
      • 2 : the separator
      • 3 : the policy modifier.
      Parameters:
      directory - Path
      namebase - base name of interest
      pattern - Regex to extract the part of the filename for a Filename
      Returns:
      Unsorted List<Filename> of matches.
    • scanIncludeBase

      public static List<Filename> scanIncludeBase(Path directory, String filename, Pattern pattern)
      Find files matching a pattern and also include the base filename.
    • fromPath

      public static Filename fromPath(Path directory, String fn, Pattern pattern)
      Create a Filename
    • shiftFiles

      public static void shiftFiles(Path directory, String filename)
      Shift files with a ".NNN" up by one, and move the base file to "filename.1".
      Parameters:
      directory -
      filename -
    • scanForIncrement

      public static List<Filename> scanForIncrement(Path directory, String filename)
      Look for matching files of the "incremental" pattern: "filename.nnn". This includes the filename itself, if it exists.
    • shiftFiles

      public static void shiftFiles(Path directory, String filename, int increment, String format)
      Parameters:
      directory -
      filename -
      increment -
      format -