public abstract class FilenameUtils
extends org.apache.commons.io.FilenameUtils
File name management utilities. Extends the provides by apache-common-IO
Constructor and Description |
---|
FilenameUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
getRelativeTo(String path,
String basePath)
Return
path as relative from basePath only if
basePath is an ancestor of path :
path basePath returns
---------- ------------- ----------
/home/user/x.txt /home/ user/x.txt
/home/user/x.txt /home/user/ x.txt
~/x.txt /home/ user/x.t
/tmp/x.txt /home/ /tmp/x.txt
C:\foo\bar\xx.txt C: foo\bar\xx.txt
C:\foo\bar\xx.txt C:\foo\ bar\xx.txt
C:\foo\bar\xx.txt C:\foo\bar\ xx.txt
|
static String |
getWithoutPrefix(String path)
Return
path as relative from basePath only if
basePath is an ancestor of path :
path returns
---------- -------------
/home/user/x.txt home/user/x.txt
~/x.txt x.txt
/tmp/x.txt tmp/x.txt
C:/foo/bar/xx.txt foo/bar/xx.txt
|
public static String getRelativeTo(String path, String basePath)
Return path
as relative from basePath
only if
basePath
is an ancestor of path
:
path basePath returns ---------- ------------- ---------- /home/user/x.txt /home/ user/x.txt /home/user/x.txt /home/user/ x.txt ~/x.txt /home/ user/x.t /tmp/x.txt /home/ /tmp/x.txt C:\foo\bar\xx.txt C: foo\bar\xx.txt C:\foo\bar\xx.txt C:\foo\ bar\xx.txt C:\foo\bar\xx.txt C:\foo\bar\ xx.txt
path
- basePath
- public static String getWithoutPrefix(String path)
Return path
as relative from basePath
only if
basePath
is an ancestor of path
:
path returns ---------- ------------- /home/user/x.txt home/user/x.txt ~/x.txt x.txt /tmp/x.txt tmp/x.txt C:/foo/bar/xx.txt foo/bar/xx.txt
path
-