Package com.stardog.stark.util
Class ParsedURI
- java.lang.Object
-
- com.stardog.stark.util.ParsedURI
-
- All Implemented Interfaces:
java.lang.Cloneable
public class ParsedURI extends java.lang.Object implements java.lang.Cloneable
A replacement for Java's own URI: java.net.URI. Java's implementation is quite buggy in that it doesn't resolve relative URIs correctly.Note: this implementation is not guaranteed to handle ipv6 addresses correctly (yet).
-
-
Constructor Summary
Constructors Constructor Description ParsedURI(java.lang.String uriSpec)
ParsedURI(java.lang.String scheme, java.lang.String schemeSpecificPart, java.lang.String fragment)
ParsedURI(java.lang.String scheme, java.lang.String authority, java.lang.String path, java.lang.String query, java.lang.String fragment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
java.lang.String
getAuthority()
java.lang.String
getFragment()
java.lang.String
getPath()
java.lang.String
getQuery()
java.lang.String
getScheme()
java.lang.String
getSchemeSpecificPart()
boolean
isAbsolute()
boolean
isHierarchical()
boolean
isOpaque()
boolean
isRelative()
boolean
isSelfReference()
Checks whether this URI is a relative URI that references itself (i.e.void
normalize()
Normalizes the path of this URI if it has one.ParsedURI
resolve(ParsedURI relURI)
Resolves a relative URI using this URI as the base URI.ParsedURI
resolve(java.lang.String relURISpec)
Resolves a relative URI using this URI as the base URI.java.lang.String
toString()
java.lang.String
toString(java.lang.StringBuilder sb)
-
-
-
Constructor Detail
-
ParsedURI
public ParsedURI(java.lang.String uriSpec)
-
ParsedURI
public ParsedURI(java.lang.String scheme, java.lang.String schemeSpecificPart, java.lang.String fragment)
-
ParsedURI
public ParsedURI(java.lang.String scheme, java.lang.String authority, java.lang.String path, java.lang.String query, java.lang.String fragment)
-
-
Method Detail
-
isHierarchical
public boolean isHierarchical()
-
isOpaque
public boolean isOpaque()
-
isAbsolute
public boolean isAbsolute()
-
isRelative
public boolean isRelative()
-
isSelfReference
public boolean isSelfReference()
Checks whether this URI is a relative URI that references itself (i.e. it only contains an anchor).
-
getScheme
public java.lang.String getScheme()
-
getSchemeSpecificPart
public java.lang.String getSchemeSpecificPart()
-
getAuthority
public java.lang.String getAuthority()
-
getPath
public java.lang.String getPath()
-
getQuery
public java.lang.String getQuery()
-
getFragment
public java.lang.String getFragment()
-
normalize
public void normalize()
Normalizes the path of this URI if it has one. Normalizing a path means that any unnecessary '.' and '..' segments are removed. For example, the URI http://server.com/a/b/../c/./d would be normalized to http://server.com/a/c/d. A URI doens't have a path if it is opaque.
-
resolve
public ParsedURI resolve(java.lang.String relURISpec)
Resolves a relative URI using this URI as the base URI.
-
resolve
public ParsedURI resolve(ParsedURI relURI)
Resolves a relative URI using this URI as the base URI.
-
toString
public java.lang.String toString(java.lang.StringBuilder sb)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.lang.Object
-
-