Class FileHelper
java.lang.Object
com.github.blutorange.maven.plugin.closurecompiler.common.FileHelper
Helper methods for working with files.
-
Method Summary
Modifier and TypeMethodDescriptionstatic File
When the file is an absolute path, return its canonical representation, if possible.static File
getAbsoluteFile
(File basedir, File... files) If the last file does not refer to an absolute path, return the file relative to the given base directories.static File
getAbsoluteFile
(File basedir, String... files) If the last file does not refer to an absolute path, return the file relative to the given base directories.static File
Sames asFileUtils.getFile(File, String...)
, but ignores empty names.Processes the includes and excludes relative to the given base directory, and returns all included files.static String
relativizePath
(File base, File target) static String
relativizeRelativePath
(File base, File target) Makes target relative to base.static boolean
startsWithBom
(File file, Charset encoding)
-
Method Details
-
relativizePath
- Returns:
- The path of the given
target
, relative to the specifiedbase
file.
-
relativizeRelativePath
Makes target relative to base. Allows base and target to be relative paths.- Returns:
- The path of the given
target
, relative to the specifiedbase
file.
-
getFile
Sames asFileUtils.getFile(File, String...)
, but ignores empty names. -
getAbsoluteFile
If the last file does not refer to an absolute path, return the file relative to the given base directories. If the last file already refers to an absolute path, return the last file.- Parameters:
basedir
- Directory relative to which to resolve relative files.files
- Files to make absolute.
-
getAbsoluteFile
If the last file does not refer to an absolute path, return the file relative to the given base directories. If the last file already refers to an absolute path, return the last file.- Parameters:
basedir
- Directory relative to which to resolve relative files.files
- Files to make absolute.
-
getIncludedFiles
public static List<File> getIncludedFiles(File baseDir, List<String> includes, List<String> excludes) Processes the includes and excludes relative to the given base directory, and returns all included files.- Parameters:
baseDir
- Base directory of the includes and excludes.includes
- List of specified includesexcludes
- List of specified excludes- Returns:
- A list of all files matching the given includes and excludes.
-
absoluteFileToCanonicalFile
When the file is an absolute path, return its canonical representation, if possible.- Parameters:
file
- The file to process.- Returns:
- The canonical path of the file, if absolute, or the file itself otherwise.
-
startsWithBom
- Throws:
IOException
-