Package org.apache.maven.wagon
Class PathUtils
- java.lang.Object
-
- org.apache.maven.wagon.PathUtils
-
public final class PathUtils extends java.lang.Object
Various path (URL) manipulation routines
-
-
Constructor Summary
Constructors Modifier Constructor Description private
PathUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static java.lang.String
authorization(java.lang.String url)
This was changed from private to package local so that it can be unit tested.static java.lang.String
basedir(java.lang.String url)
Derive the path portion of the given URL.private static java.lang.String
decode(java.lang.String url)
Decodes the specified (portion of a) URL.static java.lang.String
dirname(java.lang.String path)
Returns the directory path portion of a file specification string.static java.lang.String[]
dirnames(java.lang.String path)
private static int
endOfHostPosition(java.lang.String host, int pos)
static java.lang.String
filename(java.lang.String path)
Returns the filename portion of a file specification string.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.org
this method will returnwww.apache.org
static java.lang.String
password(java.lang.String url)
static int
port(java.lang.String url)
static java.lang.String
protocol(java.lang.String url)
/** Return the protocol name.private static java.lang.String[]
split(java.lang.String str, java.lang.String separator, int max)
static java.lang.String
toRelative(java.io.File basedir, java.lang.String absolutePath)
static java.lang.String
user(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)
-
split
private static java.lang.String[] split(java.lang.String str, java.lang.String separator, int max)
-
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.org
this method will returnwww.apache.org
- Parameters:
url
- the url- Returns:
- the host name
-
authorization
static java.lang.String authorization(java.lang.String url)
This was changed from private to package local so that it can be unit tested.
-
endOfHostPosition
private static int endOfHostPosition(java.lang.String host, int pos)
-
protocol
public static java.lang.String protocol(java.lang.String url)
/** Return the protocol name.
E.g: for inputhttp://www.codehause.org
this 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_PORT
if 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
-
decode
private static java.lang.String decode(java.lang.String url)
Decodes the specified (portion of a) URL. Note: This decoder assumes that ISO-8859-1 is used to convert URL-encoded octets to characters.- Parameters:
url
- The URL to decode, may benull
.- Returns:
- The decoded URL or
null
if the input wasnull
.
-
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)
-
-