public class XURI
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
XURI.Parts |
Modifier and Type | Field and Description |
---|---|
protected static java.util.regex.Pattern |
drivelettertest |
protected static java.util.regex.Pattern |
filedrivelettertest |
protected java.util.Map<java.lang.String,java.lang.String> |
fragfields |
protected boolean |
isfile |
protected java.util.List<java.lang.String> |
nonleadschemes |
protected java.util.Map<java.lang.String,java.lang.String> |
queryfields |
static java.util.EnumSet<XURI.Parts> |
URLALL |
static java.util.EnumSet<XURI.Parts> |
URLONLY |
static java.util.EnumSet<XURI.Parts> |
URLQUERY |
Constructor and Description |
---|
XURI(java.lang.String xu) |
XURI(java.net.URI xu) |
XURI(java.net.URL xu) |
Modifier and Type | Method and Description |
---|---|
static java.lang.String[] |
allSchemes(java.lang.String xu)
Extract all schemes at front of a url.
|
java.lang.String |
assemble(java.util.EnumSet<XURI.Parts> parts)
Reassemble the url using the specified parts
|
static java.lang.String |
canonical(java.lang.String s)
Canonicalize a part of a URL
|
protected java.util.List<java.lang.String> |
escapedsplit(java.lang.String s,
char sep,
char escape) |
protected int |
findunescaped(java.lang.String s,
int start,
char sep,
char escape,
int len) |
java.lang.String |
fixdriveletter(java.net.URI uri) |
java.util.Map<java.lang.String,java.lang.String> |
getFragFields() |
java.lang.String |
getFragment() |
java.lang.String |
getHost() |
java.lang.String |
getPath() |
int |
getPort() |
java.lang.String |
getQuery() |
java.util.Map<java.lang.String,java.lang.String> |
getQueryFields() |
java.lang.String |
getRealPath()
Return a path that can be used to open a file
|
java.lang.String |
getScheme() |
java.util.List<java.lang.String> |
getSchemes() |
java.lang.String |
getUserInfo() |
static boolean |
hasDriveLetter(java.lang.String path)
return true if this path appears to start with a windows drive letter
including those hidden by leading '/'
|
static java.lang.String |
hideDriveLetter(java.lang.String path)
Return a path with possible windows drive letter hidden by '/'.
|
protected java.util.Map<java.lang.String,java.lang.String> |
insertAmpField(java.lang.String key,
java.lang.String value,
java.lang.String query) |
void |
insertFragmentField(java.lang.String key,
java.lang.String newval)
Allow fragment fields to be inserted
|
void |
insertQueryField(java.lang.String key,
java.lang.String newval)
Allow queryfields to be inserted
|
boolean |
isFile() |
protected java.util.Map<java.lang.String,java.lang.String> |
parseAmpList(java.lang.String s,
char sep,
char escape) |
protected void |
parseFragment() |
protected void |
parseQuery() |
protected void |
rebuildQuery()
Rebuild query from current queryfields
|
protected java.util.Map<java.lang.String,java.lang.String> |
removeAmpField(java.lang.String key,
java.lang.String query) |
void |
removeQueryField(java.lang.String key)
Allow queryfields to be removed
|
void |
setFragment(java.lang.String xfragment) |
void |
setHost(java.lang.String xhost) |
void |
setPath(java.lang.String xpath) |
void |
setPort(int xport) |
void |
setQuery(java.lang.String xquery) |
void |
setScheme(java.lang.String xscheme) |
void |
setUserInfo(java.lang.String xuserinfo) |
java.lang.String |
toString() |
static java.lang.String |
truePath(java.lang.String path)
return repaired path; if this path appears to start with a windows drive letter
hidden by leading '/', then the leading '/' is removed
|
protected static final java.util.regex.Pattern drivelettertest
protected static final java.util.regex.Pattern filedrivelettertest
public static final java.util.EnumSet<XURI.Parts> URLONLY
public static final java.util.EnumSet<XURI.Parts> URLALL
public static final java.util.EnumSet<XURI.Parts> URLQUERY
protected boolean isfile
protected java.util.List<java.lang.String> nonleadschemes
protected java.util.Map<java.lang.String,java.lang.String> queryfields
protected java.util.Map<java.lang.String,java.lang.String> fragfields
public XURI(java.lang.String xu) throws java.net.URISyntaxException
java.net.URISyntaxException
public XURI(java.net.URL xu) throws java.net.URISyntaxException
java.net.URISyntaxException
public XURI(java.net.URI xu) throws java.net.URISyntaxException
java.net.URISyntaxException
public java.lang.String getUserInfo()
public java.lang.String getHost()
public int getPort()
public java.lang.String getPath()
public java.lang.String getRealPath()
public java.lang.String getQuery()
public java.lang.String getFragment()
public java.lang.String getScheme()
public java.util.List<java.lang.String> getSchemes()
public void setScheme(java.lang.String xscheme)
public void setUserInfo(java.lang.String xuserinfo)
public void setHost(java.lang.String xhost)
public void setPort(int xport)
public void setPath(java.lang.String xpath)
public void setQuery(java.lang.String xquery)
public void setFragment(java.lang.String xfragment)
public java.lang.String toString()
toString
in class java.lang.Object
public void insertQueryField(java.lang.String key, java.lang.String newval)
key
- newval
- public void insertFragmentField(java.lang.String key, java.lang.String newval)
key
- newval
- public void removeQueryField(java.lang.String key)
key
- protected void rebuildQuery()
public boolean isFile()
public java.util.Map<java.lang.String,java.lang.String> getQueryFields()
public java.util.Map<java.lang.String,java.lang.String> getFragFields()
protected void parseQuery()
protected void parseFragment()
protected java.util.Map<java.lang.String,java.lang.String> insertAmpField(java.lang.String key, java.lang.String value, java.lang.String query)
protected java.util.Map<java.lang.String,java.lang.String> removeAmpField(java.lang.String key, java.lang.String query)
protected java.util.Map<java.lang.String,java.lang.String> parseAmpList(java.lang.String s, char sep, char escape)
protected java.util.List<java.lang.String> escapedsplit(java.lang.String s, char sep, char escape)
protected int findunescaped(java.lang.String s, int start, char sep, char escape, int len)
public java.lang.String assemble(java.util.EnumSet<XURI.Parts> parts)
parts
- to includepublic java.lang.String fixdriveletter(java.net.URI uri) throws java.net.URISyntaxException
java.net.URISyntaxException
public static java.lang.String canonical(java.lang.String s)
s
- part of the urlpublic static boolean hasDriveLetter(java.lang.String path)
path
- public static java.lang.String hideDriveLetter(java.lang.String path)
public static java.lang.String[] allSchemes(java.lang.String xu)
public static java.lang.String truePath(java.lang.String path)
path
-