Class FilteringUtils
java.lang.Object
org.apache.maven.shared.filtering.FilteringUtils
- Author:
- Olivier Lamy, Dennis Lundberg
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancopyFile(Path from, Path to, String inputEncoding, String outputEncoding, FilterWrapper[] wrappers, ChangeDetection changeDetection) Copy and optionally filter a file using separate input and output encodings.static voidcopyFile(Path from, Path to, String encoding, FilterWrapper[] wrappers, boolean overwrite) Deprecated.static booleancopyFile(Path from, Path to, String encoding, FilterWrapper[] wrappers, ChangeDetection changeDetection) Copies a file from the source to the destination, applying the specified filters if provided.static StringescapeWindowsPath(String val) static StringgetRelativeFilePath(String oldPath, String newPath) This method can calculate the relative path between two paths on a file system.static PathresolveFile(Path baseFile, String filename) Resolve a filefilenameto its canonical form.
-
Field Details
-
COPY_BUFFER_LENGTH
public static final int COPY_BUFFER_LENGTH- See Also:
-
-
Method Details
-
escapeWindowsPath
-
resolveFile
Resolve a filefilenameto its canonical form. Iffilenameis relative (doesn't start with/), it is resolved relative tobaseFile. Otherwise it is treated as a normal root-relative path.- Parameters:
baseFile- where to resolvefilenamefrom, iffilenameis relativefilename- absolute or relative file path to resolve- Returns:
- the canonical
Fileoffilename
-
getRelativeFilePath
This method can calculate the relative path between two paths on a file system.
PathTool.getRelativeFilePath( null, null ) = "" PathTool.getRelativeFilePath( null, "/usr/local/java/bin" ) = "" PathTool.getRelativeFilePath( "/usr/local", null ) = "" PathTool.getRelativeFilePath( "/usr/local", "/usr/local/java/bin" ) = "java/bin" PathTool.getRelativeFilePath( "/usr/local", "/usr/local/java/bin/" ) = "java/bin" PathTool.getRelativeFilePath( "/usr/local/java/bin", "/usr/local/" ) = "../.." PathTool.getRelativeFilePath( "/usr/local/", "/usr/local/java/bin/java.sh" ) = "java/bin/java.sh" PathTool.getRelativeFilePath( "/usr/local/java/bin/java.sh", "/usr/local/" ) = "../../.." PathTool.getRelativeFilePath( "/usr/local/", "/bin" ) = "../../bin" PathTool.getRelativeFilePath( "/bin", "/usr/local/" ) = "../usr/local/"
Note: The path separator is always/, regardless of the operating system.- Parameters:
oldPath- old pathnewPath- new path- Returns:
- a relative file path from
oldPath.
-
copyFile(Path, Path, String, FilterWrapper[], ChangeDetection)instead