Class FileHelper
java.lang.Object
com.github.blutorange.maven.plugin.closurecompiler.common.FileHelper
Helper methods for working with files.
-
Method Summary
Modifier and TypeMethodDescriptionstatic FileWhen the file is an absolute path, return its canonical representation, if possible.static FilegetAbsoluteFile(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 FilegetAbsoluteFile(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 FileSames 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 StringrelativizePath(File base, File target) static StringrelativizeRelativePath(File base, File target) Makes target relative to base.static booleanstartsWithBom(File file, Charset encoding)
-
Method Details
-
relativizePath
- Returns:
- The path of the given
target, relative to the specifiedbasefile.
-
relativizeRelativePath
Makes target relative to base. Allows base and target to be relative paths.- Returns:
- The path of the given
target, relative to the specifiedbasefile.
-
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
-