Class PathUtils

java.lang.Object
org.apache.maven.wagon.PathUtils

public final class PathUtils extends Object
Various path (URL) manipulation routines
Author:
Michal Maczka
  • Method Details

    • dirname

      public static String dirname(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 String filename(String path)
      Returns the filename portion of a file specification string.
      Returns:
      The filename string with extension.
    • dirnames

      public static String[] dirnames(String path)
    • host

      public static String host(String url)
      Return the host name (Removes protocol and path from the URL) E.g: for input http://www.codehause.org this method will return www.apache.org
      Parameters:
      url - the url
      Returns:
      the host name
    • protocol

      public static String protocol(String url)
      /** Return the protocol name.
      E.g: for input http://www.codehause.org this method will return http
      Parameters:
      url - the url
      Returns:
      the host name
    • port

      public static int port(String url)
      Parameters:
      url -
      Returns:
      the port or WagonConstants.UNKNOWN_PORT if not existent
    • basedir

      public static String basedir(String url)
      Derive the path portion of the given URL.
      Parameters:
      url - the repository URL
      Returns:
      the basedir of the repository
    • user

      public static String user(String url)
    • password

      public static String password(String url)
    • toRelative

      public static String toRelative(File basedir, String absolutePath)