|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.uva.vlet.vrl.VRL
public final class VRL
URI compatible VRL class. Specifies the location of a resource.
This object is NON muteable ! (May not be changed, once instanciated) Use duplicators and/or constructors to modify VRLs!
Currenlty also compatible with the URL class!
Hierarchy: An absolute URL 'is a' VRL 'is a' URI.
Note that each class has it subtile differences.
Important:
a VRL object is an URI, but not all URIs
are Locations! The URI class is used to decode/encode Locations.
One big difference is that "file:///A File" and "file:///A%20File" are different URIs but
point to the same VRL !
The VRL URIs are decoded and normalized so they can be compared.
Current used (URI compatible) syntax is:
<scheme>://[<userinfo>@][<hostname[:port]<]/<path>[?<querystring>]
VRLStreamHandlerFactory
,
URI
,
URL
,
Serialized FormField Summary | |
---|---|
static char |
antiSepChar
Stupid window backslahes. |
static java.lang.String |
doubleSepCharStr
Double Seperator character as String. |
static char |
sepChar
Seperator character. |
static java.lang.String |
sepCharStr
Seperator character as String. |
Constructor Summary | |
---|---|
VRL(java.lang.String locationString)
Somewhat more flexible initializer then new URI(String). |
|
VRL(java.lang.String scheme,
java.lang.String newhost,
int newport,
java.lang.String newpath)
Create new VRL with scheme, hostname, port and path |
|
VRL(java.lang.String scheme,
java.lang.String hostname,
java.lang.String path)
Create new VRL with scheme,hostname and path |
|
VRL(java.lang.String scheme,
java.lang.String user,
java.lang.String host,
int newPort,
java.lang.String newPath)
Create new VRL with scheme, userinformation, hostname, port and path |
|
VRL(java.lang.String scheme,
java.lang.String host,
java.lang.String path,
java.lang.String frag)
Constructs VRL with scheme,hostname,path,fragment |
|
VRL(java.net.URI uri)
Construct new VRL from URI. Important: This Constructor does not copy the URI as-is, since a VRL does not support all URI functionality. |
|
VRL(java.net.URL url)
|
|
VRL(VRL base,
java.lang.String relpath)
Creates new VRL, resolves relative Uri String to baseLocation. |
|
VRL(VRL baseLocation,
java.lang.String relativeUri,
boolean useDirname)
|
Method Summary | |
---|---|
static java.lang.String |
basename(java.lang.String path)
returns basename part (last part) of path String. |
VRL |
clone()
|
int |
compareTo(VRL loc)
Compares this location to loc. |
static java.lang.String |
dirname(java.lang.String path)
Returns the dirname part of the URI compatbile path ! (parent directory path) of path. |
VRL |
duplicate()
Same as 'clone()' Method is here for historical reasons. |
VRL |
duplicateWithAddedPath(java.lang.String dirname)
Creates new location by appending path to this one |
VRL |
duplicateWithNewBasename(java.lang.String optNewName)
|
VRL |
duplicateWithNewPath(java.lang.String newPath)
Create duplicate, but setpath to newPath |
VRL |
duplicateWithNewPort(int val)
Changing a port in a Location object is not allowed due to the immutable paradigm of Location object (similar to URIs), so to change a port a new object must be created with the changed value. |
VRL |
duplicateWithNewScheme(java.lang.String newscheme)
Used for scheme subtitution |
static java.lang.String |
encode(java.lang.String string)
|
static java.lang.String |
extension(java.lang.String name)
|
VRL |
getBaseLocation()
Returns base VRL without Query ("?...") or Fragment ("#...") part |
java.lang.String |
getBasename()
|
java.lang.String |
getBasename(boolean withExtension)
returns basename part (last part) of this location. |
java.lang.String |
getDirname()
Returns (decoded) parent directory part of path |
java.lang.String |
getExtension()
Get last part of filename starting from a '.' |
java.lang.String |
getFragment()
Return part afer '#' |
java.lang.String |
getHostname()
Returns hostname part of VRL |
VRL |
getParent()
Returns new location which *could* be the parent location |
java.lang.String |
getPassword()
Deprecated. It is NOT save to use clear text password in any URI! |
java.lang.String |
getPath()
|
java.lang.String[] |
getPathElements()
Returns array of path elements. |
int |
getPort()
Get port part of URI or 0 if non specified/default must be used |
java.lang.String |
getQuery()
|
VAttributeSet |
getQueryAttributes()
If a query has a set of properties in the form "?name=value&name2=..." return the set of properties as a VAtributeSet. |
java.lang.String[] |
getQueryParts()
Returns list of expressions seperated by a '&' |
java.lang.String |
getRawPath()
Return 'raw' path as specfied by URI.getRawPath() |
java.lang.String |
getScheme()
Get Scheme or service type like: "gftp" from "gftp://" or "srb" from "srb://..." |
java.lang.String |
getUserinfo()
Returns user name part form userInfo string Note that for SRB URIs this INCLUDES the domainName like 'user.domain@...' this method strips optional password information. |
java.lang.String |
getUserInfoWithPassword()
Returns complete userInfo part of URI. |
int |
hashCode()
Returns the hashcode of the String representation of this VRL. |
boolean |
hasSameServer(VRL remoteLoc)
Checks wether server hostname and port are the same |
static boolean |
hostnamesAreEquivelant(java.lang.String host1,
java.lang.String host2)
returns true if and only true if both hostnames point to the same physical host. |
boolean |
isLocalHostname()
|
boolean |
isParentOf(VRL subLocation)
check whether URI (and path) is a parent location of subLocation . |
boolean |
isRootPath()
|
boolean |
isURL()
|
boolean |
isVLink()
|
VRL |
plus(java.lang.String path)
Add path and return new VRL |
VRL |
resolve(java.lang.String reluri)
Resolves optional relative URI using this URI as base location. |
VRL |
resolvePath(java.lang.String relpath)
Resolve DECODED (no %-chars) relative path against this URI, assuming this URI is a (directory) PATH and not a file or url location. |
static java.lang.String |
reverseDNSlookup(java.lang.String name)
Returns fully qualified hostname by means of reverse DNS lookup |
static java.lang.String |
stripExtension(java.lang.String name)
|
java.net.URL |
toDirURL()
Return URL, but with an added "/". |
java.lang.String |
toString()
This method returns the DECODED URI string. |
java.net.URI |
toURI()
Returns URI compatible object of VRL. Here path components might be encoded in %XX format! use toString for unencoded VRL String. |
java.lang.String |
toURIString()
Returns URI compatible and optionally encoded string, use toString() for default (non-encoded) VRL String! |
java.net.URL |
toURL()
Since 06-06-2006 this now provides a fully VRL compatible URL object. |
static java.lang.String |
uripath(java.lang.String orgpath)
Produce URI compatible path (forward slashes) and do other normalization (change 'c:' into '/c:/' This method is mainly used to tranform windows paths... |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final char sepChar
public static final char antiSepChar
public static final java.lang.String sepCharStr
public static final java.lang.String doubleSepCharStr
Constructor Detail |
---|
public VRL(java.net.URI uri)
uri
- public VRL(java.lang.String locationString) throws VlURISyntaxException
VlURISyntaxException
public VRL(java.lang.String scheme, java.lang.String host, java.lang.String path, java.lang.String frag)
public VRL(java.lang.String scheme, java.lang.String newhost, int newport, java.lang.String newpath)
public VRL(java.lang.String scheme, java.lang.String user, java.lang.String host, int newPort, java.lang.String newPath)
public VRL(java.lang.String scheme, java.lang.String hostname, java.lang.String path)
public VRL(VRL base, java.lang.String relpath) throws VlURISyntaxException
VlException
VlException
VlURISyntaxException
public VRL(VRL baseLocation, java.lang.String relativeUri, boolean useDirname) throws VlURISyntaxException
VlURISyntaxException
public VRL(java.net.URL url) throws VlException
VlException
Method Detail |
---|
public static java.lang.String reverseDNSlookup(java.lang.String name)
public static boolean hostnamesAreEquivelant(java.lang.String host1, java.lang.String host2)
public java.lang.String getFragment()
public java.net.URI toURI() throws VlURISyntaxException
VlException
VlURISyntaxException
toString
,
URI
public int hashCode()
hashCode
in class java.lang.Object
String.hashCode();
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getScheme()
public java.lang.String getHostname()
public java.lang.String getPath()
public java.lang.String getUserInfoWithPassword()
public java.lang.String getUserinfo()
public java.lang.String getPassword()
public java.lang.String getQuery()
public java.lang.String[] getQueryParts()
public java.lang.String getDirname()
dirname
,
basename
public java.lang.String getExtension()
public static java.lang.String dirname(java.lang.String path)
Special cases:
basename
public java.lang.String getBasename(boolean withExtension)
withExtension
- whether to keep the extension.public java.lang.String getBasename()
public boolean isParentOf(VRL subLocation)
subLocation
.
subLocation
-
public int compareTo(VRL loc)
toString
public VRL duplicate()
public VRL clone()
clone
in class java.lang.Object
public boolean hasSameServer(VRL remoteLoc)
public int getPort()
public VRL getParent()
public VRL plus(java.lang.String path)
public VRL duplicateWithAddedPath(java.lang.String dirname)
public boolean isVLink()
public static java.lang.String stripExtension(java.lang.String name)
public boolean isLocalHostname()
public boolean isRootPath()
public boolean isURL()
public java.net.URL toURL() throws VlURISyntaxException
VlException
VlURISyntaxException
public VRL getBaseLocation()
public VAttributeSet getQueryAttributes()
public VRL duplicateWithNewPort(int val)
val
-
public VRL duplicateWithNewPath(java.lang.String newPath)
public VRL duplicateWithNewScheme(java.lang.String newscheme)
public java.lang.String[] getPathElements()
public VRL duplicateWithNewBasename(java.lang.String optNewName)
public VRL resolve(java.lang.String reluri) throws VlURISyntaxException
VlException
VlURISyntaxException
public VRL resolvePath(java.lang.String relpath) throws VlURISyntaxException
relpath
-
VlException
VlURISyntaxException
public java.net.URL toDirURL()
public java.lang.String getRawPath()
URI.getRawPath()
public static java.lang.String uripath(java.lang.String orgpath)
public static java.lang.String encode(java.lang.String string)
public static java.lang.String extension(java.lang.String name)
public static java.lang.String basename(java.lang.String path)
public java.lang.String toURIString() throws VlURISyntaxException
VlException
VlURISyntaxException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |