public abstract class IRI extends AbsIRIFactoryImpl implements IRIFactoryI, IRIRelativize
IRIFactory
. Methods allow:
Violation
s of the
standards being enforced.
The standards, and other setttings,
which are used in the methods are
determined by the configuration of the IRIFactory
used to create this IRI.
To check for conformance with a different standard,
the IRI must be passed to IRIFactoryI.create(IRI)
of a different appropriately configured IRIFactory
.
Modifier and Type | Field and Description |
---|---|
static int |
ILLFORMED_PORT
Return code from
getPort() ,
indicating that a port component was found,
but it is not a non-negative integer. |
static int |
NO_PORT
Return code from
getPort() ,
indicating no port component found. |
ABSOLUTE, CHILD, GRANDPARENT, NETWORK, PARENT, SAMEDOCUMENT
Constructor and Description |
---|
IRI() |
Modifier and Type | Method and Description |
---|---|
abstract String |
getASCIIHost()
The host part of the authority, encoded
as an International Domain Name.
|
abstract String |
getAuthority()
The authority component, found between
the first "//" and the next "/".
|
abstract String |
getFragment()
The fragment, found after a "#" at the end
of the main URI (note a fragment may itself
contain a "#").
|
abstract String |
getHost()
The host part of the authority.
|
abstract String |
getPath()
The path component of the IRI; always
present, possibly the empty string.
|
abstract int |
getPort()
The port number from the authority component.
|
abstract String |
getQuery()
The query component of the IRI.
|
abstract String |
getRawAuthority()
The authority component, found between
the first "//" and the next "/".
|
abstract String |
getRawFragment()
The fragment, found after a "#" at the end
of the main URI (note a fragment may itself
contain a "#").
|
abstract String |
getRawHost()
The host part of the authority.
|
abstract String |
getRawPath()
The path component of the IRI; always
present, possibly the empty string.
|
abstract String |
getRawQuery()
The query component of the IRI.
|
abstract String |
getRawUserinfo()
The user information part of the authority
component of the IRI.
|
abstract String |
getScheme()
The scheme component of the IRI.
|
abstract String |
getUserinfo()
The user information part of the authority
component of the IRI.
|
abstract boolean |
hasViolation(boolean includeWarnings)
Are there any violations of the factory's
specification settings.
|
abstract boolean |
isAbsolute()
Does this IRI specify a scheme.
|
abstract boolean |
isRelative()
Is this IRI a relative reference without
a scheme specified.
|
abstract boolean |
isRootless()
Is this an 'opaque' IRI.
|
abstract int |
ladderEquals(IRI iri)
To be defined: use the comparison ladder.
|
abstract boolean |
ladderEquals(IRI iri,
int other)
To be defined: use the comparison ladder.
|
static void |
main(String[] args)
Check one or more IRIs against a specification.
|
abstract IRI |
normalize(boolean useDns)
To be defined -
return result does not violate any minting conditions.
|
abstract IRI |
relativize(IRI abs)
Returns an IRI that when resolved against
this IRI would return
abs . |
abstract IRI |
relativize(IRI abs,
int flags)
Returns an IRI that when resolved against
this IRI would return
abs . |
abstract IRI |
relativize(String abs)
Returns an IRI that when resolved against
this IRI would return
abs . |
abstract IRI |
relativize(String abs,
int flags)
Returns an IRI that when resolved against
this IRI would return
abs . |
IRI |
resolve(IRI relative)
Resolves an IRI against this one.
|
IRI |
resolve(String relative)
Resolves an IRI against this one.
|
abstract String |
toASCIIString()
Converts the IRI into ASCII.
|
abstract String |
toDisplayString()
The IRI string with any recommended bi-directional control
characters (if necessary) to ensure correct display.
|
abstract String |
toString()
The logical IRI string as originally specified,
use
toDisplayString() for display purposes
such as error messages. |
abstract URL |
toURL()
Converts the IRI to an ASCII string, and then to a URL.
|
abstract Iterator<Violation> |
violations(boolean includeWarnings)
The error and warning conditions
associated with this IRI violating the
standards associated with its factory.
|
construct, construct, create, create
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
construct, construct, create, create
public static final int NO_PORT
getPort()
,
indicating no port component found.public static final int ILLFORMED_PORT
getPort()
,
indicating that a port component was found,
but it is not a non-negative integer.public abstract Iterator<Violation> violations(boolean includeWarnings)
includeWarnings
- If true then warnings are returned as well as errors.Violation
s found which violate the
factory's standards.public abstract String getRawAuthority()
public abstract String getAuthority()
getRawAuthority()
.public abstract String getRawFragment()
public abstract String getFragment()
getRawFragment()
.public abstract String getRawHost()
public abstract String getHost()
getRawHost()
.public abstract String getASCIIHost() throws MalformedURLException
getRawHost()
.MalformedURLException
- An Internationalized Domain Name algorithm failed, there is no equivalent ascii string.public abstract String getRawPath()
public abstract String getPath()
getRawPath()
.public abstract int getPort()
NO_PORT
or ILLFORMED_PORT
.public abstract String getRawQuery()
public abstract String getQuery()
getRawQuery()
.public abstract String getScheme()
public abstract String getRawUserinfo()
ViolationCodes.HAS_PASSWORD
.
No decoding is done; this method is cheap.public abstract String getUserinfo()
ViolationCodes.HAS_PASSWORD
.
Any legal percent escape sequences are decoded.
This method may be more expensive than getRawUserinfo()
.public abstract boolean hasViolation(boolean includeWarnings)
violations(includeWarnings).hasNext()
,
but faster.includeWarnings
- If true then warnings are reported as well as errors.public abstract boolean isAbsolute()
public abstract boolean isRootless()
public abstract boolean isRelative()
public abstract IRI relativize(IRI abs, int flags)
abs
.
If possible, a relative IRI is formed,
using any of the methods specified in flags,
which is a bitwise or of values from
IRIRelativize
.
If abs
contains a dot
segment (either "/./" or "/../") then
the contract cannot be satisfied and an incorrect
answer is returned. This incorrect return value has an
ViolationCodes.NON_INITIAL_DOT_SEGMENT
violation associated with it.
abs
- An absolute IRI to make relative.flags
- Which type of relative IRIs to permit.public abstract IRI relativize(IRI abs)
abs
.
If possible, a relative IRI is formed,
using default methods.
If abs
contains a dot
segment (either "/./" or "/../") then
the contract cannot be satisfied and an incorrect
answer is returned. This incorrect return value has an
ViolationCodes.NON_INITIAL_DOT_SEGMENT
violation associated with it.
abs
- An absolute IRI to make relative.public abstract IRI relativize(String abs)
abs
.
If possible, a relative IRI is formed,
using default methods.
If abs
contains a dot
segment (either "/./" or "/../") then
the contract cannot be satisfied and an incorrect
answer is returned. This incorrect return value has an
ViolationCodes.NON_INITIAL_DOT_SEGMENT
violation associated with it.
abs
- An absolute IRI to make relative.public abstract IRI relativize(String abs, int flags)
abs
.
If possible, a relative IRI is formed,
using any of the methods specified in flags,
which is a bitwise or of values from
IRIRelativize
.
If abs
contains a dot
segment (either "/./" or "/../") then
the contract cannot be satisfied and an incorrect
answer is returned. This incorrect return value has an
ViolationCodes.NON_INITIAL_DOT_SEGMENT
violation associated with it.
abs
- An absolute IRI to make relative.flags
- Which type of relative IRIs to permit.public abstract String toASCIIString() throws MalformedURLException
MalformedURLException
- An Internationalized Domain Name algorithm failed, there is no equivalent ascii string.public abstract String toString()
toDisplayString()
for display purposes
such as error messages.public abstract String toDisplayString()
public abstract URL toURL() throws MalformedURLException
MalformedURLException
- If IDNA conversion failed, or from java.net.URLpublic final IRI resolve(IRI relative)
IRIFactoryImpl.create(IRI)
.relative
- AbsIRIFactoryImpl.construct(IRI)
public final IRI resolve(String relative)
IRIFactoryImpl.create(String)
.relative
- AbsIRIFactoryImpl.construct(String)
public abstract IRI normalize(boolean useDns)
useDns
- If true, do DNS look ups to normalize hostname.public abstract boolean ladderEquals(IRI iri, int other)
iri
- other
- Specifies where on the ladder to make the comparison.public abstract int ladderEquals(IRI iri)
iri
- ladderEquals(IRI, int)
true, or -1 if none.public static void main(String[] args)
java <classpath> [ -help ] [ -iri | -uri | -xml | -schema | -xlink ] [ -f file ] [ iri ... ]If no file or iris are specified on the command line, then standard input is used. In fact more than one spec can be used, in which case violations of any of them are reported.
args
- Copyright ? 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP