public class FileListFactory
extends java.lang.Object
Constructor and Description |
---|
FileListFactory() |
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
cleanup(java.lang.String input)
Replace any file system separators with the OS-specific version and honor the comment character.
|
private static java.lang.String |
commentLine(java.lang.String input)
Check if the line is a comment line.
|
static FileList |
createBlacklist(java.lang.String rootPath,
java.lang.String spec,
boolean recurse,
boolean cs,
java.lang.String blacklist,
java.io.PrintStream err)
Create an instance using the given inputs.
|
static FileList |
createExplicit(java.lang.String filename,
java.io.PrintStream err)
Create an instance using the given inputs.
|
static FileSet |
loadFileSet(java.lang.String filename,
java.io.PrintStream err)
Load a file set, from a disk file.
|
private static void |
malformedFileSetLine(java.lang.String line,
int idx,
java.lang.String filename)
Raise an
IllegalStateException to report an error when reading a file-set configuration file. |
static FileList |
processFileSet(FileSet fileSet,
boolean caseSens)
Resolve the file set, by using the initial files (loaded from the reference directory or explicit file
names), and applying the Include and eXclude operations.
|
static java.lang.String[] |
resolvePaths(java.lang.String[] paths)
Given a list of directory paths, resolve them in terms that they will match the exact path as reported
on the operating system were the conversion is ran.
|
public static FileList processFileSet(FileSet fileSet, boolean caseSens) throws java.io.IOException
fileSet
- The file set.caseSens
- Flag indicating if the legacy operating system is case-sensitive or not.java.io.IOException
- In case of problems reading files from disk.public static FileSet loadFileSet(java.lang.String filename, java.io.PrintStream err)
D <recursive_top_level_dir> <file_spec>
adds a top level dir and file spec which will be
recursively processed to add 0 or more files into the reference file list.N <non_recursive_top_level_dir> <file_spec>
adds a top level dir and file spec which will be
non-recursively processed to add 0 or more files into the listF <absolute_or_relative_file_name>
- explicitly adds a single/individual file into the list
X <exclusion_filter_expression_including_wildcards>
- filter to remove from the listI <inclusion_filter_expression_including_wildcards>
- filter to add something removed back
into the list# this is a comment
, a line starting with a # character, representing a comment, which will
be ignoredfilename
- The file name from which to load the file set.err
- The stream to write any errors.null
in case it could not be loaded.public static FileList createExplicit(java.lang.String filename, java.io.PrintStream err)
filename
- Text file name containing the list of files from which to create the list.err
- The location to print errors or null
if the error should be consumed silently.null
if there is a failure.public static FileList createBlacklist(java.lang.String rootPath, java.lang.String spec, boolean recurse, boolean cs, java.lang.String blacklist, java.io.PrintStream err)
rootPath
- Path to the top level root directory in which files will be listed.spec
- Regex controlling which files in the root path will be processed.recurse
- true
to process subdirectories recursively.cs
- true
to process with case-sensitivity.blacklist
- The filename of the ignore list.err
- The location to print errors or null
if the error should be consumed silently.null
if there is a failure.public static java.lang.String[] resolvePaths(java.lang.String[] paths) throws java.io.IOException
paths
- The paths to resolve.java.io.IOException
- In case a path can't be resolved.private static void malformedFileSetLine(java.lang.String line, int idx, java.lang.String filename)
IllegalStateException
to report an error when reading a file-set configuration file.line
- The original line.idx
- The line index in the file.filename
- The name of the file.private static java.lang.String commentLine(java.lang.String input)
input
- The line to check.null
if the line starts with '#' character.private static java.lang.String cleanup(java.lang.String input)
#
) character, then the entire line is ignored
(dropped from the output). A hash character anywhere else in a given line is treated as valid text.input
- Name of the file to be read. Must be relative to the current directory or fully
qualified.null
if this is a comment.