Class AbsIRIImpl

All Implemented Interfaces:
IRIComponents, IRIFactoryI, IRIRelativize, ViolationCodes
Direct Known Subclasses:
IRIImpl, ResolvedRelativeIRI

public abstract class AbsIRIImpl extends IRI implements ViolationCodes, IRIComponents
  • Constructor Details

    • AbsIRIImpl

      public AbsIRIImpl()
  • Method Details

    • 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
    • toURI

      public URI toURI() throws URISyntaxException
      Description copied from class: IRI
      Converts the IRI to an ASCII string, and then to a java.net.URI.
      Specified by:
      toURI in class IRI
      Returns:
      a URL corresponding to this IRI.
      Throws:
      URISyntaxException - If IDNA conversion failed.
    • toASCIIString

      public String toASCIIString() throws MalformedIDNException
      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:
      MalformedIDNException
    • 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
      Parameters:
      iri - 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
      Parameters:
      iri - IRI
      Returns:
      A value for other to make IRI.ladderEquals(IRI, int) true, or -1 if none.