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 java.lang.String |
getRelativeTo(java.lang.String path,
java.lang.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 java.lang.String |
getWithoutPrefix(java.lang.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 java.lang.String getRelativeTo(java.lang.String path, java.lang.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 java.lang.String getWithoutPrefix(java.lang.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
-