Package org.apache.maven.wagon
Class PathUtils
- java.lang.Object
-
- org.apache.maven.wagon.PathUtils
-
public final class PathUtils extends java.lang.ObjectVarious path (URL) manipulation routines- Author:
- Michal Maczka
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringbasedir(java.lang.String url)Derive the path portion of the given URL.static java.lang.Stringdirname(java.lang.String path)Returns the directory path portion of a file specification string.static java.lang.String[]dirnames(java.lang.String path)static java.lang.Stringfilename(java.lang.String path)Returns the filename portion of a file specification string.static java.lang.Stringhost(java.lang.String url)Return the host name (Removes protocol and path from the URL) E.g: for inputhttp://www.codehause.orgthis method will returnwww.apache.orgstatic java.lang.Stringpassword(java.lang.String url)static intport(java.lang.String url)static java.lang.Stringprotocol(java.lang.String url)/** Return the protocol name.static java.lang.StringtoRelative(java.io.File basedir, java.lang.String absolutePath)static java.lang.Stringuser(java.lang.String url)
-
-
-
Method Detail
-
dirname
public static java.lang.String dirname(java.lang.String path)
Returns the directory path portion of a file specification string. Matches the equally named unix command.- Returns:
- The directory portion excluding the ending file separator.
-
filename
public static java.lang.String filename(java.lang.String path)
Returns the filename portion of a file specification string.- Returns:
- The filename string with extension.
-
dirnames
public static java.lang.String[] dirnames(java.lang.String path)
-
host
public static java.lang.String host(java.lang.String url)
Return the host name (Removes protocol and path from the URL) E.g: for inputhttp://www.codehause.orgthis method will returnwww.apache.org- Parameters:
url- the url- Returns:
- the host name
-
protocol
public static java.lang.String protocol(java.lang.String url)
/** Return the protocol name.
E.g: for inputhttp://www.codehause.orgthis method will returnhttp- Parameters:
url- the url- Returns:
- the host name
-
port
public static int port(java.lang.String url)
- Parameters:
url-- Returns:
- the port or
WagonConstants.UNKNOWN_PORTif not existent
-
basedir
public static java.lang.String basedir(java.lang.String url)
Derive the path portion of the given URL.- Parameters:
url- the repository URL- Returns:
- the basedir of the repository
-
user
public static java.lang.String user(java.lang.String url)
-
password
public static java.lang.String password(java.lang.String url)
-
toRelative
public static java.lang.String toRelative(java.io.File basedir, java.lang.String absolutePath)
-
-