com.hp.hpl.jena.iri.impl
Class AbsIRIImpl

java.lang.Object
  extended by com.hp.hpl.jena.iri.impl.AbsIRIFactoryImpl
      extended by com.hp.hpl.jena.iri.IRI
          extended by com.hp.hpl.jena.iri.impl.AbsIRIImpl
All Implemented Interfaces:
IRIComponents, IRIFactoryI, IRIRelativize, ViolationCodes
Direct Known Subclasses:
IRIImpl, ResolvedRelativeIRI

public abstract class AbsIRIImpl
extends IRI
implements ViolationCodes, IRIComponents


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.hp.hpl.jena.iri.ViolationCodes
ViolationCodes.Initialize
 
Field Summary
 
Fields inherited from class com.hp.hpl.jena.iri.IRI
ILLFORMED_PORT, NO_PORT
 
Fields inherited from interface com.hp.hpl.jena.iri.ViolationCodes
ACE_PREFIX, BAD_BIDI_SUBCOMPONENT, BAD_DOT_IN_IDN, BAD_IDN, BAD_IDN_UNASSIGNED_CHARS, BIDI_FORMATTING_CHARACTER, COMPATIBILITY_CHARACTER, CONTROL_CHARACTER, DEFAULT_PORT_SHOULD_BE_OMITTED, DEPRECATED_UNICODE_CHARACTER, DISCOURAGED_IRI_CHARACTER, DISCOURAGED_XML_CHARACTER, DNS_LABEL_DASH_START_OR_END, DNS_LABEL_LENGTH_LIMIT, DNS_LENGTH_LIMIT, DOUBLE_DASH_IN_REG_NAME, DOUBLE_WHITESPACE, EMPTY_SCHEME, HAS_PASSWORD, ILLEGAL_CHARACTER, ILLEGAL_PERCENT_ENCODING, IP_V4_OCTET_RANGE, IP_V6_OR_FUTURE_ADDRESS_SYNTAX, IPv6ADDRESS_SHOULD_BE_LOWERCASE, LONE_SURROGATE, LOWERCASE_PREFERRED, MAYBE_NOT_NFC, MAYBE_NOT_NFKC, NON_INITIAL_DOT_SEGMENT, NON_URI_CHARACTER, NON_XML_CHARACTER, NOT_DNS_NAME, NOT_NFC, NOT_NFKC, NOT_UTF8_ESCAPE, NOT_UTF8_ESCAPE_IN_HOST, NOT_XML_SCHEMA_WHITESPACE, PERCENT, PERCENT_20, PERCENT_ENCODING_SHOULD_BE_UPPERCASE, PORT_SHOULD_NOT_BE_EMPTY, PORT_SHOULD_NOT_BE_WELL_KNOWN, PORT_SHOULD_NOT_START_IN_ZERO, PRIVATE_USE_CHARACTER, PROHIBITED_COMPONENT_PRESENT, QUERY_IN_LEGACY_SCHEME, REQUIRED_COMPONENT_MISSING, SCHEME_INCLUDES_DASH, SCHEME_MUST_START_WITH_LETTER, SCHEME_PATTERN_MATCH_FAILED, SCHEME_PREFERS_LOWERCASE, SCHEME_REQUIRES_LOWERCASE, SUPERFLUOUS_ASCII_PERCENT_ENCODING, SUPERFLUOUS_NON_ASCII_PERCENT_ENCODING, UNASSIGNED_UNICODE_CHARACTER, UNDEFINED_UNICODE_CHARACTER, UNICODE_CONTROL_CHARACTER, UNICODE_WHITESPACE, UNREGISTERED_IANA_SCHEME, UNREGISTERED_NONIETF_SCHEME_TREE, UNWISE_CHARACTER, USE_PUNYCODE_NOT_PERCENTS, WHITESPACE
 
Fields inherited from interface com.hp.hpl.jena.iri.IRIComponents
AUTHORITY, FRAGMENT, HOST, PATH, PATHQUERY, PORT, QUERY, SCHEME, USER
 
Fields inherited from interface com.hp.hpl.jena.iri.IRIRelativize
ABSOLUTE, CHILD, GRANDPARENT, NETWORK, PARENT, SAMEDOCUMENT
 
Constructor Summary
AbsIRIImpl()
           
 
Method Summary
 Iterator<Violation> allViolations()
           
 IRI create(IRI i)
          Make a new IRI object (possibly including IRI resolution), and check it for violations of the standards being enforced by the factory.
 IRI create(String s)
          Make a new IRI object (possibly including IRI resolution), and check it for violations of the standards being enforced by the factory.
 boolean equals(Object o)
           
 String getASCIIHost()
          The host part of the authority, encoded as an International Domain Name.
 String getAuthority()
          The authority component, found between the first "//" and the next "/".
 String getFragment()
          The fragment, found after a "#" at the end of the main URI (note a fragment may itself contain a "#").
 String getHost()
          The host part of the authority.
 String getPath()
          The path component of the IRI; always present, possibly the empty string.
 int getPort()
          The port number from the authority component.
 String getQuery()
          The query component of the IRI.
 String getRawAuthority()
          The authority component, found between the first "//" and the next "/".
 String getRawFragment()
          The fragment, found after a "#" at the end of the main URI (note a fragment may itself contain a "#").
 String getRawHost()
          The host part of the authority.
 String getRawPath()
          The path component of the IRI; always present, possibly the empty string.
 String getRawQuery()
          The query component of the IRI.
 String getRawUserinfo()
          The user information part of the authority component of the IRI.
 String getScheme()
          The scheme component of the IRI.
 String getUserinfo()
          The user information part of the authority component of the IRI.
 int hashCode()
           
 boolean hasViolation(boolean includeWarnings)
          Are there any violations of the factory's specification settings.
 boolean isAbsolute()
          Does this IRI specify a scheme.
 boolean isRelative()
          Is this IRI a relative reference without a scheme specified.
 boolean isRootless()
          Is this an 'opaque' IRI.
 int ladderEquals(IRI iri)
          To be defined: use the comparison ladder.
 boolean ladderEquals(IRI iri, int other)
          To be defined: use the comparison ladder.
 IRI normalize(boolean useDns)
          To be defined - return result does not violate any minting conditions.
 IRI relativize(IRI abs)
          Returns an IRI that when resolved against this IRI would return abs.
 IRI relativize(IRI abs, int flags)
          Returns an IRI that when resolved against this IRI would return abs.
 IRI relativize(String abs)
          Returns an IRI that when resolved against this IRI would return abs.
 IRI relativize(String abs, int flags)
          Returns an IRI that when resolved against this IRI would return abs.
 String toASCIIString()
          Converts the IRI into ASCII.
 String toDisplayString()
          The IRI string with any recommended bi-directional control characters (if necessary) to ensure correct display.
 URL toURL()
          Converts the IRI to an ASCII string, and then to a URL.
 Iterator<Violation> violations(boolean includeWarnings)
          The error and warning conditions associated with this IRI violating the standards associated with its factory.
 
Methods inherited from class com.hp.hpl.jena.iri.IRI
main, resolve, resolve, toString
 
Methods inherited from class com.hp.hpl.jena.iri.impl.AbsIRIFactoryImpl
construct, construct
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.hp.hpl.jena.iri.IRIFactoryI
construct, construct
 

Constructor Detail

AbsIRIImpl

public AbsIRIImpl()
Method Detail

isAbsolute

public boolean isAbsolute()
Description copied from class: IRI
Does this IRI specify a scheme.

Specified by:
isAbsolute in class IRI
Returns:
True if this IRI has a scheme specified.

isRelative

public boolean isRelative()
Description copied from class: IRI
Is this IRI a relative reference without a scheme specified.

Specified by:
isRelative in class IRI
Returns:
True if the IRI is a relative reference

hasViolation

public boolean hasViolation(boolean includeWarnings)
Description copied from class: IRI
Are there any violations of the factory's specification settings. Quick check, equivalent to violations(includeWarnings).hasNext(), but faster.

Specified by:
hasViolation in class IRI
Parameters:
includeWarnings - If true then warnings are reported as well as errors.
Returns:
true if the factory's specifications have been violated.

violations

public Iterator<Violation> violations(boolean includeWarnings)
Description copied from class: IRI
The error and warning conditions associated with this IRI violating the standards associated with its factory.

Specified by:
violations in class IRI
Parameters:
includeWarnings - If true then warnings are returned as well as errors.
Returns:
The Violations found which violate the factory's standards.

toURL

public URL toURL()
          throws MalformedURLException
Description copied from class: IRI
Converts the IRI to an ASCII string, and then to a URL.

Specified by:
toURL in class IRI
Returns:
a URL corresponding to this IRI.
Throws:
MalformedURLException - If IDNA conversion failed, or from java.net.URL

toASCIIString

public String toASCIIString()
                     throws MalformedURLException
Description copied from class: IRI
Converts the IRI into ASCII. The hostname is converted into punycode; other components are converted using percent encoding. Even if the IRI is already ASCII, the hostname may be modified, if, for example, it (inappropriately) uses percent encoding. This may be impossible (even in the ASCII case), in which case an exception is thrown.

Specified by:
toASCIIString in class IRI
Returns:
An ASCII string corresponding to this IRI.
Throws:
MalformedURLException - An Internationalized Domain Name algorithm failed, there is no equivalent ascii string.

relativize

public IRI relativize(String abs,
                      int flags)
Description copied from class: IRI
Returns an IRI that when resolved against this IRI would return 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.

Specified by:
relativize in class IRI
Parameters:
abs - An absolute IRI to make relative.
flags - Which type of relative IRIs to permit.
Returns:
A relative or absolute IRI equivalent to abs.

relativize

public IRI relativize(String abs)
Description copied from class: IRI
Returns an IRI that when resolved against this IRI would return 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.

Specified by:
relativize in class IRI
Parameters:
abs - An absolute IRI to make relative.
Returns:
A relative or absolute IRI equivalent to abs.

relativize

public IRI relativize(IRI abs)
Description copied from class: IRI
Returns an IRI that when resolved against this IRI would return 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.

Specified by:
relativize in class IRI
Parameters:
abs - An absolute IRI to make relative.
Returns:
A relative or absolute IRI equivalent to abs.

relativize

public IRI relativize(IRI abs,
                      int flags)
Description copied from class: IRI
Returns an IRI that when resolved against this IRI would return 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.

Specified by:
relativize in class IRI
Parameters:
abs - An absolute IRI to make relative.
flags - Which type of relative IRIs to permit.
Returns:
A relative or absolute IRI equivalent to abs.

allViolations

public Iterator<Violation> allViolations()

getRawUserinfo

public String getRawUserinfo()
Description copied from class: IRI
The user information part of the authority component of the IRI. Found before the first "@" in the authority. May include a ":" separating the user name from a password, ViolationCodes.HAS_PASSWORD. No decoding is done; this method is cheap.

Specified by:
getRawUserinfo in class IRI
Returns:
The user information, or null if none.

getPort

public int getPort()
Description copied from class: IRI
The port number from the authority component. Found after the last ":" in the authority.

Specified by:
getPort in class IRI
Returns:
The port number, or IRI.NO_PORT or IRI.ILLFORMED_PORT.

getRawQuery

public String getRawQuery()
Description copied from class: IRI
The query component of the IRI. Found after the "?" and before an optional "#". No decoding is done; this method is cheap.

Specified by:
getRawQuery in class IRI
Returns:
The query component, or null if none.

getRawFragment

public String getRawFragment()
Description copied from class: IRI
The fragment, found after a "#" at the end of the main URI (note a fragment may itself contain a "#"). No decoding is done; this method is cheap.

Specified by:
getRawFragment in class IRI
Returns:
The fragment, or null if none,

getRawHost

public String getRawHost()
Description copied from class: IRI
The host part of the authority. Found between an optional "@" and an optional ":" in the authority. No decoding is done; this method is cheap.

Specified by:
getRawHost in class IRI
Returns:
The host, or null if none.

getScheme

public String getScheme()
Description copied from class: IRI
The scheme component of the IRI. Found before the first ":".

Specified by:
getScheme in class IRI
Returns:
The scheme component, or null if none.

getRawPath

public String getRawPath()
Description copied from class: IRI
The path component of the IRI; always present, possibly the empty string. This includes any leading "/". Found after the authority, and before any "?" or "#". No decoding is done; this method is cheap.

Specified by:
getRawPath in class IRI
Returns:
The path.

isRootless

public boolean isRootless()
Description copied from class: IRI
Is this an 'opaque' IRI. Is this IRI an absolute IRI with a path matching the path-rootless production: i.e. it has a scheme but no authority, and a path not starting in "/". Note: in the earlier RFC 2396 this concept was called being opaque.

Specified by:
isRootless in class IRI
Returns:
True if the non-empty path of this non-relative IRI is rootless

getRawAuthority

public String getRawAuthority()
Description copied from class: IRI
The authority component, found between the first "//" and the next "/". No decoding is done; this method is cheap.

Specified by:
getRawAuthority in class IRI
Returns:
The authority component, or null if none.

create

public IRI create(IRI i)
Description copied from interface: IRIFactoryI
Make a new IRI object (possibly including IRI resolution), and check it for violations of the standards being enforced by the factory. This method both allows IRI resolution against a base, and for creating a new IRI using a different factory, with different conformance settings, implementing a different URI or IRI standard, or variant thereof. This method does not throw exceptions, but records all errors and warnings found to be queried later using IRI.hasViolation(boolean) and IRI.violations(boolean).

Specified by:
create in interface IRIFactoryI
Specified by:
create in class AbsIRIFactoryImpl
Parameters:
i - The IRI to use.
Returns:
A new IRI object.

create

public IRI create(String s)
Description copied from interface: IRIFactoryI
Make a new IRI object (possibly including IRI resolution), and check it for violations of the standards being enforced by the factory. This method does not throw exceptions, but records all errors and warnings found to be queried later using IRI.hasViolation(boolean) and IRI.violations(boolean).

Specified by:
create in interface IRIFactoryI
Overrides:
create in class AbsIRIFactoryImpl
Parameters:
s - The IRI to use.
Returns:
A new IRI object.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getAuthority

public String getAuthority()
Description copied from class: IRI
The authority component, found between the first "//" and the next "/". Any legal percent escape sequences are decoded. If the host name is an Internationalized Domain Name, then that is decoded too. This method may be more expensive than IRI.getRawAuthority().

Specified by:
getAuthority in class IRI
Returns:
The authority component, or null if none.

getFragment

public String getFragment()
Description copied from class: IRI
The fragment, found after a "#" at the end of the main URI (note a fragment may itself contain a "#"). Any legal percent escape sequences are decoded. This method may be more expensive than IRI.getRawFragment().

Specified by:
getFragment in class IRI
Returns:
The fragment, or null if none,

getHost

public String getHost()
Description copied from class: IRI
The host part of the authority. Found between an optional "@" and an optional ":" in the authority. Any legal percent escape sequences are decoded. Any legal punycode is decoded. This method may be more expensive than IRI.getRawHost().

Specified by:
getHost in class IRI
Returns:
The host, or null if none.

getPath

public String getPath()
Description copied from class: IRI
The path component of the IRI; always present, possibly the empty string. This includes any leading "/". Found after the authority, and before any "?" or "#". Any legal percent escape sequences are decoded. This method may be more expensive than IRI.getRawPath().

Specified by:
getPath in class IRI
Returns:
The path.

getQuery

public String getQuery()
Description copied from class: IRI
The query component of the IRI. Found after the "?" and before an optional "#". Any legal percent escape sequences are decoded. This method may be more expensive than IRI.getRawQuery().

Specified by:
getQuery in class IRI
Returns:
The query component, or null if none.

getUserinfo

public String getUserinfo()
Description copied from class: IRI
The user information part of the authority component of the IRI. Found before the first "@" in the authority. May include a ":" separating the user name from a password, ViolationCodes.HAS_PASSWORD. Any legal percent escape sequences are decoded. This method may be more expensive than IRI.getRawUserinfo().

Specified by:
getUserinfo in class IRI
Returns:
The user information, or null if none.

normalize

public IRI normalize(boolean useDns)
Description copied from class: IRI
To be defined - return result does not violate any minting conditions.

Specified by:
normalize in class IRI
Parameters:
useDns - If true, do DNS look ups to normalize hostname.
Returns:
An equivalent, normalized IRI

toDisplayString

public String toDisplayString()
Description copied from class: IRI
The IRI string with any recommended bi-directional control characters (if necessary) to ensure correct display.

Specified by:
toDisplayString in class IRI
Returns:
The IRI string formatted with unicode bidi control characters

getASCIIHost

public String getASCIIHost()
                    throws MalformedURLException
Description copied from class: IRI
The host part of the authority, encoded as an International Domain Name. Any legal percent escape sequences are decoded. Any non-ASCII characters are encoded as punycode, if possible. This may be impossible (even in the ASCII case), in which case an exception is thrown. This method may be more expensive than IRI.getRawHost().

Specified by:
getASCIIHost in class IRI
Returns:
The host as an IDN, or null if none.
Throws:
MalformedURLException - An Internationalized Domain Name algorithm failed, there is no equivalent ascii string.

ladderEquals

public boolean ladderEquals(IRI iri,
                            int other)
Description copied from class: IRI
To be defined: use the comparison ladder.

Specified by:
ladderEquals in class IRI
other - Specifies where on the ladder to make the comparison.
Returns:
True if this IRI is equal to the given one, when normalized with rules specified by other.

ladderEquals

public int ladderEquals(IRI iri)
Description copied from class: IRI
To be defined: use the comparison ladder.

Specified by:
ladderEquals in class IRI
Returns:
A value for other to make IRI.ladderEquals(IRI, int) true, or -1 if none.


Copyright ? 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP