- java.lang.Object
-
- org.eclipse.jgit.transport.URIish
-
- All Implemented Interfaces:
Serializable
public class URIish extends Object implements 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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)StringgetHost()Get host name part.StringgetHumanishName()Get the "humanish" part of the path.StringgetPass()Get password requested for transferStringgetPath()Get path name componentintgetPort()Get port number requested for transfer or -1 if not explicitStringgetRawPath()Get path name componentStringgetScheme()Get protocol nameStringgetUser()Get user name requested for transferinthashCode()booleanisRemote()Whether this URI references a repository on another system.URIishsetHost(String n)Return a new URI matching this one, but with a different host.URIishsetPass(String n)Return a new URI matching this one, but with a different password.URIishsetPath(String n)Return a new URI matching this one, but with a different path.URIishsetPort(int n)Return a new URI matching this one, but with a different port.URIishsetRawPath(String n)Return a new URI matching this one, but with a different (raw) path.URIishsetScheme(String n)Return a new URI matching this one, but with a different scheme.URIishsetUser(String n)Return a new URI matching this one, but with a different user.StringtoASCIIString()Get the URI as an ASCII string.StringtoPrivateASCIIString()Convert the URI including password, formatted with only ASCII characters such that it will be valid for use over the network.StringtoPrivateString()Obtain the string form of the URI, with the password included.StringtoString()
-
-
-
Constructor Detail
-
URIish
public URIish(String s) throws URISyntaxException
Parse and construct anURIishfrom a string- Parameters:
s- aStringobject.- Throws:
URISyntaxException
-
URIish
public URIish(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()
Whether this URI references a repository on another system.- Returns:
- true if this URI references a repository on another system.
-
getHost
public String getHost()
Get host name part.- Returns:
- host name part or null
-
setHost
public URIish setHost(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 String getScheme()
Get protocol name- Returns:
- protocol name or null for local references
-
setScheme
public URIish setScheme(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 String getPath()
Get path name component- Returns:
- path name component
-
getRawPath
public String getRawPath()
Get path name component- Returns:
- path name component
-
setPath
public URIish setPath(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(String n) throws 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:
URISyntaxException
-
getUser
public String getUser()
Get user name requested for transfer- Returns:
- user name requested for transfer or null
-
setUser
public URIish setUser(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 String getPass()
Get password requested for transfer- Returns:
- password requested for transfer or null
-
setPass
public URIish setPass(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()
Get port number requested for transfer or -1 if not explicit- 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.
-
toPrivateString
public String toPrivateString()
Obtain the string form of the URI, with the password included.- Returns:
- the URI, including its password field, if any.
-
toASCIIString
public String toASCIIString()
Get the URI as an ASCII string.- Returns:
- the URI as an ASCII string. Password is not included.
-
toPrivateASCIIString
public String toPrivateASCIIString()
Convert the URI including password, formatted with only ASCII characters such that it will be valid for use over the network.- Returns:
- the URI including password, formatted with only ASCII characters such that it will be valid for use over the network.
-
getHumanishName
public String getHumanishName() throws IllegalArgumentException
Get the "humanish" part of the path. Some examples of a 'humanish' part for a full path:Path Humanish part /path/to/repo.gitrepo/path/to/repo.git//path/to/repo/.git/path/to/repo/localhostssh://localhost//path//toan empty string - Returns:
- the "humanish" part of the path. May be an empty string. Never
null. - Throws:
IllegalArgumentException- if it's impossible to determine a humanish part, or path isnullor empty- See Also:
getPath()
-
-