public class FileSystemUtils extends Object
Modifier and Type | Field and Description |
---|---|
static List<String> |
DEFAULT_RECURSIVE_INCLUDES |
static List<String> |
DEFAULT_SCM_IGNORE_PATTERNS |
static String |
RECURSIVE_FILE_INCLUDE_PATTERN |
Constructor and Description |
---|
FileSystemUtils() |
Modifier and Type | Method and Description |
---|---|
static CopyFileResult |
copyFile(File src,
File dst) |
protected static void |
copyFiles(File srcDir,
List<File> files,
File dstDir) |
static List<CopyFileResult> |
copyFiles(List<CopyFileRequest> requests) |
protected static void |
fillInMD5Results(DirDiff diff) |
static List<File> |
getAllNonScmFiles(File dir)
Return a recursive listing of all files in the directory ignoring
++/.svn/++ and ++/.git/++ |
static List<File> |
getAllNonScmFiles(File dir,
List<String> scmIgnorePatterns)
Return a recursive listing of all files in the directory ignoring files that match
scmIgnorePatterns |
static List<CopyFileRequest> |
getCopyFileRequests(File srcDir,
List<String> includes,
List<String> excludes,
File dstDir) |
static DirectoryDiff |
getDiff(DirectoryDiffRequest request)
Deprecated.
|
static DirectoryDiff |
getDiff(File dir1,
File dir2,
List<String> includes,
List<String> excludes)
Deprecated.
|
static List<File> |
getFiles(File dir,
List<String> includes,
List<String> excludes) |
static List<File> |
getFullPaths(File dir,
List<String> relativePaths) |
static List<File> |
getFullPaths(File dir,
Set<String> relativePaths) |
static DirDiff |
getMD5Diff(DirRequest request)
Compare 2 directories on the file system and return an object containing the results.
|
static MD5Result |
getMD5Result(File source,
File target) |
static List<MD5Result> |
getMD5Results(List<File> sources,
List<File> targets) |
static DirDiff |
getQuickDiff(DirRequest request) |
static String |
getRelativePath(File dir,
File file) |
static String |
getRelativePathQuietly(File parentDir,
File file)
Return the relative path to
file from parentDir . |
protected static List<String> |
getRelativePaths(File dir,
List<File> files) |
static List<File> |
getSortedFullPaths(File dir,
List<String> relativePaths) |
static boolean |
isParent(File parent,
File child)
Return true if child lives on the file system somewhere underneath parent, false otherwise.
|
static MonitorTextFileResult |
monitorTextFile(File file,
String token,
int intervalMillis,
int timeoutMillis,
String encoding)
Examine the contents of a text file, stopping as soon as it contains
token , or timeout is exceeded, whichever comes first. |
static DirectoryDiff |
prepareScmDir(PrepareScmDirRequest request)
Deprecated.
|
static DirectoryDiff |
prepareScmDir(PrepareScmDirRequest request,
File relativeDir,
boolean diffOnly)
Deprecated.
|
static List<SyncResult> |
syncFiles(List<SyncRequest> requests) |
static SyncResult |
syncFiles(SyncRequest request) |
static SyncResult |
syncFilesQuietly(SyncRequest request) |
public static final String RECURSIVE_FILE_INCLUDE_PATTERN
public static final List<String> DEFAULT_RECURSIVE_INCLUDES
public static final List<String> DEFAULT_SCM_IGNORE_PATTERNS
public FileSystemUtils()
public static List<File> getAllNonScmFiles(File dir)
++/.svn/++
and ++/.git/++
public static List<File> getAllNonScmFiles(File dir, List<String> scmIgnorePatterns)
scmIgnorePatterns
@Deprecated public static DirectoryDiff prepareScmDir(PrepareScmDirRequest request)
1 - both - files that exist in both directories 2 - dir1Only - files that exist in the source directory but not the SCM directory 3 - dir2Only - files that exist in the SCM directory but not the source directoryThis provides enough information for SCM tooling to then complete the work of making the SCM directory exactly match the file system directory and commit any changes to the SCM system.
@Deprecated public static DirectoryDiff prepareScmDir(PrepareScmDirRequest request, File relativeDir, boolean diffOnly)
1 - both - files that exist in both directories 2 - dir1Only - files that exist in the source directory but not the SCM directory 3 - dir2Only - files that exist in the SCM directory but not the source directoryThis provides enough information for SCM tooling to then complete the work of making the SCM directory exactly match the file system directory and commit any changes to the SCM system.
@Deprecated public static DirectoryDiff getDiff(File dir1, File dir2, List<String> includes, List<String> excludes)
public static DirDiff getMD5Diff(DirRequest request)
1 - Both - Files that exist in both directories 2 - Different - Files that exist in both directories but who's MD5 checksums do not match 3 - Identical - Files that exist in both directories with matching MD5 checksums 4 - Source Dir Only - Files that exist only in the source directory 5 - Target Dir Only - Files that exist only in the target directoryThe 5 lists in
DirDiff
contain the relative paths to files for each category.protected static void fillInMD5Results(DirDiff diff)
public static MD5Result getMD5Result(File source, File target)
@Deprecated public static DirectoryDiff getDiff(DirectoryDiffRequest request)
1 - Both - Files that exist in both directories 2 - Dir 1 Only - Files that exist only in directory 1 3 - Dir 2 Only - Files that exist only in directory 2The 3 lists in
DirectoryDiff
contain the relative paths to files for each category.public static DirDiff getQuickDiff(DirRequest request)
public static MonitorTextFileResult monitorTextFile(File file, String token, int intervalMillis, int timeoutMillis, String encoding)
token
, or timeout
is exceeded, whichever comes first.public static List<SyncResult> syncFiles(List<SyncRequest> requests) throws IOException
IOException
public static SyncResult syncFilesQuietly(SyncRequest request)
public static SyncResult syncFiles(SyncRequest request) throws IOException
IOException
protected static void copyFiles(File srcDir, List<File> files, File dstDir) throws IOException
IOException
public static List<File> getSortedFullPaths(File dir, List<String> relativePaths)
public static boolean isParent(File parent, File child)
public static String getRelativePathQuietly(File parentDir, File file)
file
from parentDir
. parentDir
is optional and can be null
. If parentDir
is not
supplied (or is not a parent directory to file
the canonical path to file
is returned.public static String getRelativePath(File dir, File file)
public static List<CopyFileRequest> getCopyFileRequests(File srcDir, List<String> includes, List<String> excludes, File dstDir)
public static CopyFileResult copyFile(File src, File dst)
public static List<CopyFileResult> copyFiles(List<CopyFileRequest> requests)
Copyright © 2010–2014 The Kuali Foundation. All rights reserved.