Class PathUtils


  • public final class PathUtils
    extends java.lang.Object
    Various path (URL) manipulation routines
    Author:
    Michal Maczka
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String basedir​(java.lang.String url)
      Derive the path portion of the given 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)  
      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 input http://www.codehause.org this method will return www.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.
      static java.lang.String toRelative​(java.io.File basedir, java.lang.String absolutePath)  
      static java.lang.String user​(java.lang.String url)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 input http://www.codehause.org this method will return www.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 input http://www.codehause.org this method will return http
        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
      • 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)