Package net.sourceforge.pmd.util
Class FileUtil
- java.lang.Object
-
- net.sourceforge.pmd.util.FileUtil
-
@Deprecated @InternalApi public final class FileUtil extends Object
Deprecated.Is internal APIThis is a utility class for working with Files.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static List<DataSource>
collectFiles(String fileLocations, FilenameFilter filenameFilter)
Deprecated.Collects a list of DataSources using a comma separated list of input file locations to process.static boolean
findPatternInFile(File file, String pattern)
Deprecated.Handy method to find a certain pattern into a file.static String
getFileNameWithoutExtension(String fileName)
Deprecated.Helper method to get a filename without its extensionstatic String
normalizeFilename(String fileName)
Deprecated.Normalizes the filename by taking the casing into account, e.g.static String
readFilelist(File filelist)
Deprecated.Reads the file, which contains the filelist.
-
-
-
Method Detail
-
getFileNameWithoutExtension
public static String getFileNameWithoutExtension(String fileName)
Deprecated.Helper method to get a filename without its extension- Parameters:
fileName
- String- Returns:
- String
-
normalizeFilename
public static String normalizeFilename(String fileName)
Deprecated.Normalizes the filename by taking the casing into account, e.g. on Windows, the filename is changed to lowercase only.- Parameters:
fileName
- the file name- Returns:
- the normalized file name
-
collectFiles
public static List<DataSource> collectFiles(String fileLocations, FilenameFilter filenameFilter)
Deprecated.Collects a list of DataSources using a comma separated list of input file locations to process. If a file location is a directory, the directory hierarchy will be traversed to look for files. If a file location is a ZIP or Jar the archive will be scanned looking for files. If a file location is a file, it will be used. For each located file, a FilenameFilter is used to decide whether to return a DataSource.- Parameters:
fileLocations
- A comma-separated list of file locations.filenameFilter
- The FilenameFilter to apply to files.- Returns:
- A list of DataSources, one for each file collected.
-
findPatternInFile
public static boolean findPatternInFile(File file, String pattern)
Deprecated.Handy method to find a certain pattern into a file. While this method lives in the FileUtils, it was designed with with unit test in mind (to check result redirected into a file)- Parameters:
file
-pattern
-- Returns:
-
readFilelist
public static String readFilelist(File filelist) throws IOException
Deprecated.Reads the file, which contains the filelist. This is used for the command line arguments --filelist/-filelist for both PMD and CPD. The separator in the filelist is a command and/or newlines.- Parameters:
filelist
- the file which contains the list of path names- Returns:
- a comma-separated list of file paths
- Throws:
IOException
- if the file couldn't be read
-
-