Class URIish

  • All Implemented Interfaces:
    java.io.Serializable

    public class URIish
    extends java.lang.Object
    implements java.io.Serializable
    This URI like construct used for referencing Git archives over the net, as well as locally stored archives. It is similar to RFC 2396 URI's, but also support SCP and the malformed file://<path> syntax (as opposed to the correct file:<path> syntax.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      URIish()
      Create an empty, non-configured URI.
      URIish​(java.lang.String s)
      Parse and construct an URIish from a string
      URIish​(java.net.URL u)
      Construct a URIish from a standard URL.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.String getHost()  
      java.lang.String getHumanishName()
      Get the "humanish" part of the path.
      java.lang.String getPass()  
      java.lang.String getPath()  
      int getPort()  
      java.lang.String getRawPath()  
      java.lang.String getScheme()  
      java.lang.String getUser()  
      int hashCode()  
      boolean isRemote()  
      URIish setHost​(java.lang.String n)
      Return a new URI matching this one, but with a different host.
      URIish setPass​(java.lang.String n)
      Return a new URI matching this one, but with a different password.
      URIish setPath​(java.lang.String n)
      Return a new URI matching this one, but with a different path.
      URIish setPort​(int n)
      Return a new URI matching this one, but with a different port.
      URIish setRawPath​(java.lang.String n)
      Return a new URI matching this one, but with a different (raw) path.
      URIish setScheme​(java.lang.String n)
      Return a new URI matching this one, but with a different scheme.
      URIish setUser​(java.lang.String n)
      Return a new URI matching this one, but with a different user.
      java.lang.String toASCIIString()  
      java.lang.String toPrivateASCIIString()  
      java.lang.String toPrivateString()
      Obtain the string form of the URI, with the password included.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • URIish

        public URIish​(java.lang.String s)
               throws java.net.URISyntaxException
        Parse and construct an URIish from a string
        Parameters:
        s -
        Throws:
        java.net.URISyntaxException
      • URIish

        public URIish​(java.net.URL u)
        Construct a URIish from a standard URL.
        Parameters:
        u - the source URL to convert from.
      • URIish

        public URIish()
        Create an empty, non-configured URI.
    • Method Detail

      • isRemote

        public boolean isRemote()
        Returns:
        true if this URI references a repository on another system.
      • getHost

        public java.lang.String getHost()
        Returns:
        host name part or null
      • setHost

        public URIish setHost​(java.lang.String n)
        Return a new URI matching this one, but with a different host.
        Parameters:
        n - the new value for host.
        Returns:
        a new URI with the updated value.
      • getScheme

        public java.lang.String getScheme()
        Returns:
        protocol name or null for local references
      • setScheme

        public URIish setScheme​(java.lang.String n)
        Return a new URI matching this one, but with a different scheme.
        Parameters:
        n - the new value for scheme.
        Returns:
        a new URI with the updated value.
      • getPath

        public java.lang.String getPath()
        Returns:
        path name component
      • getRawPath

        public java.lang.String getRawPath()
        Returns:
        path name component
      • setPath

        public URIish setPath​(java.lang.String n)
        Return a new URI matching this one, but with a different path.
        Parameters:
        n - the new value for path.
        Returns:
        a new URI with the updated value.
      • setRawPath

        public URIish setRawPath​(java.lang.String n)
                          throws java.net.URISyntaxException
        Return a new URI matching this one, but with a different (raw) path.
        Parameters:
        n - the new value for path.
        Returns:
        a new URI with the updated value.
        Throws:
        java.net.URISyntaxException
      • getUser

        public java.lang.String getUser()
        Returns:
        user name requested for transfer or null
      • setUser

        public URIish setUser​(java.lang.String n)
        Return a new URI matching this one, but with a different user.
        Parameters:
        n - the new value for user.
        Returns:
        a new URI with the updated value.
      • getPass

        public java.lang.String getPass()
        Returns:
        password requested for transfer or null
      • setPass

        public URIish setPass​(java.lang.String n)
        Return a new URI matching this one, but with a different password.
        Parameters:
        n - the new value for password.
        Returns:
        a new URI with the updated value.
      • getPort

        public int getPort()
        Returns:
        port number requested for transfer or -1 if not explicit
      • setPort

        public URIish setPort​(int n)
        Return a new URI matching this one, but with a different port.
        Parameters:
        n - the new value for port.
        Returns:
        a new URI with the updated value.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toPrivateString

        public java.lang.String toPrivateString()
        Obtain the string form of the URI, with the password included.
        Returns:
        the URI, including its password field, if any.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toASCIIString

        public java.lang.String toASCIIString()
        Returns:
        the URI as an ASCII string. Password is not included.
      • toPrivateASCIIString

        public java.lang.String toPrivateASCIIString()
        Returns:
        the URI including password, formatted with only ASCII characters such that it will be valid for use over the network.
      • getHumanishName

        public java.lang.String getHumanishName()
                                         throws java.lang.IllegalArgumentException
        Get the "humanish" part of the path. Some examples of a 'humanish' part for a full path:
        Path Humanish part
        /path/to/repo.git repo
        /path/to/repo.git/
        /path/to/repo/.git
        /path/to/repo/
        /path//to an empty string
        Returns:
        the "humanish" part of the path. May be an empty string. Never null.
        Throws:
        java.lang.IllegalArgumentException - if it's impossible to determine a humanish part, or path is null or empty
        See Also:
        getPath()