public class TestFileUtils extends Object
Modifier and Type | Field and Description |
---|---|
static FileFilter |
DIRS_ONLY_FILTER |
static FilenameFilter |
NON_CVS_DIRS_FILTER |
Constructor and Description |
---|
TestFileUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
compareDirsText(File fstDir,
File sndDir)
Compares the content of two directories and report all differences in the returned text string.
|
static void |
copyDirectoryNonCVS(File from,
File to)
Copy an entire directory from one location to another, skipping CVS directories.
|
static File |
createTempDir(String prefix,
String suffix)
Make a temporary directory using File.createTempFile.
|
static File |
createTempDir(String prefix,
String suffix,
File directory)
Make a temporary directory using File.createTempFile.
|
static List<File> |
findFiles(File start,
FileFilter filter)
Find files recursively that match the given filter.
|
static String |
getDifferences(String s1,
String s2)
Return textual description of the differences between two strings.
|
public static final FilenameFilter NON_CVS_DIRS_FILTER
public static final FileFilter DIRS_ONLY_FILTER
public TestFileUtils()
public static final void copyDirectoryNonCVS(File from, File to) throws IOFailure
from
- Original directory (or file, for that matter) to copy.to
- Destination directory, i.e. the 'new name' of the copy of the from directory.IOFailure
public static String compareDirsText(File fstDir, File sndDir) throws IOFailure
fstDir
- The directory to compare with sndDirsndDir
- The directory to compare with fstDirIOFailure
- if there are problems reading the content of the dirs.public static String getDifferences(String s1, String s2)
s1
- strings to compares2
- strings to comparepublic static File createTempDir(String prefix, String suffix) throws IOException
prefix
- suffix
- IOException
public static File createTempDir(String prefix, String suffix, File directory) throws IOException
prefix
- suffix
- directory
- IOException
public static List<File> findFiles(File start, FileFilter filter)
start
- The directory (or file) to start at.filter
- Filter of files to include. All files (including directories) are passed to this filter and are
included if filter.accept() returns true. Subdirectories are scanned whether or not filter.accept() returns true
for them.Copyright © 2005–2015 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.