com.ihr.xbrl.util

## Class URITools

- java.lang.Object
- - com.ihr.xbrl.util.URITools

-     public class URITools
      extends java.lang.Object

  The Class URITools.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `URITools()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `areSameUri(java.net.URI uri1, java.net.URI uri2)` Are same uri.
    `static java.lang.String` | `decodeUri(java.lang.String uri)` Decodes a string according to RFC 2396.
    `static void` | `decodeUri(java.lang.String uri, java.lang.StringBuffer buf)` Decodes a string according to RFC 2396.
    `static java.lang.String` | `decodeUriInUTF8(java.lang.String uri)` Decode URI string and convert UTF8 encoded characters to Java string characters.
    `static java.lang.String` | `encodeUri(java.lang.String uri)` Encodes a string according to RFC 2396.
    `static void` | `encodeUri(java.lang.String uri, java.lang.StringBuffer buf)` Encodes a string according to RFC 2396.
    `static java.net.URI` | `fixEndWithSlash(java.lang.String uri)` Creates an URI that ends with a slash character '/' if the input string in the uri parameter does not ends with the slash character.
    `static java.lang.String` | `fixFileSchemeURIToString(java.net.URI uri)` If the URI passed in as a parameter is of the file: scheme, then toString does not return file:/// but file:/ This seems to be incorrect so this method just fix this.
    `static java.net.URI` | `getDetectIsURIOrFile(java.lang.String fileString)` Detects if the input string is a file uri, a remote uri or a local file name and returns a uri pointing to the target.
    `static java.net.URI` | `getNormalURI(java.net.URI sinonimURI)` Gets the normal uri.
    `static java.lang.String` | `hashResources()` Hash resources.
    `static java.net.URI` | `makeAbsolute(java.net.URI base, java.net.URI uri)` Make absolute.
    `static java.net.URI` | `makeProperFileName(java.net.URI baseURI, DTSContainer dts, java.lang.String extension)` Generates an absolute file name in the same directory indicated by baseURI using the role type to extract information from it and adding the extension indicated in the extension parameter.
    `static java.net.URI` | `makeProperFileName(java.net.URI baseURI, XBRLRoleType role, java.lang.String extension)` Generates an absolute file name in the same directory indicated by baseURI using the role type to extract information from it and adding the extension indicated in the extension parameter.
    `static java.lang.String` | `packURI(java.lang.String uri, int maxLength)` Takes a string representation of an URI and packs it to a maximum length of maxLenght characters.
    `static java.net.URI` | `relativize(java.net.URI base, java.net.URI full)` Creates a new URI that contains a path relative to the base URI.
    `static java.net.URI` | `relativizeMore(java.net.URI from, java.net.URI to)` Computes a relative path from the URI in the from argument to the URI in the to argument This function does not work if the incoming parameters contain several slashes together ie (file:/C:/hello////this%20is%20a%20test).
    `static java.net.URI` | `removeFragment(java.net.URI uri)` Removes the fragment.
    `static java.lang.String` | `removeTrailingSlash(java.lang.String pathName)` Removes forward slash characters and the end of this pathName.
    `static java.lang.String` | `resolveXBRLScheme(java.lang.String uriIsASCII)` If the protocol of this URI is xbrl. change it to be http or file
    `static boolean` | `safeCheckIsFilePath(java.lang.String uri)` Safe check is file path.
    `static boolean` | `safeCheckIsFileUri(java.lang.String uri)` Returns true if the string is a valid URI.
    `static boolean` | `safeCheckIsHttpUri(java.lang.String uri)` Safe check is http uri.
    `static boolean` | `safeCheckIsUriValid(java.lang.String uri)` Safe check is uri valid.
    `static java.lang.String` | `URItoFileString(java.lang.String path)` If the path passed in is a URI using the file scheme, this method will return back a file name using OS conventions.
    `static java.net.URI` | `URLtoFileName(java.net.URL u)` This function transforms a URL of the form file:/C:/Program Files/svs/xbrljlib-2.0.jar into a proper file URI to be used as a parameter for the File(URI) method.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### URITools

          public URITools()

  - ### Method Detail

    - #### getNormalURI

          public static java.net.URI getNormalURI(java.net.URI sinonimURI)

      Gets the normal uri.
      Parameters:
        `sinonimURI` - the sinonim uri
      Returns:
        the normal uri

    - #### areSameUri

          public static boolean areSameUri(java.net.URI uri1,
                           java.net.URI uri2)

      Are same uri.
      Parameters:
        `uri1` - the uri1
        `uri2` - the uri2
      Returns:
        true, if successful

    - #### makeAbsolute

          public static java.net.URI makeAbsolute(java.net.URI base,
                                  java.net.URI uri)

      Make absolute.
      Parameters:
        `base` - the base
        `uri` - the uri
      Returns:
        the uri

    - #### relativize

          public static java.net.URI relativize(java.net.URI base,
                                java.net.URI full)

      Creates a new URI that contains a path relative to the base URI. This function does not adds .. to go from the base path to the full path
      Parameters:
        `base` - URI
        `full` - URI
      Returns:
        URI

    - #### relativizeMore

          public static java.net.URI relativizeMore(java.net.URI from,
                                    java.net.URI to)

      Computes a relative path from the URI in the from argument to the URI in the to argument This function does not work if the incoming parameters contain several slashes together ie (file:/C:/hello////this%20is%20a%20test).
      Parameters:
        `from` - URI Absolute URI
        `to` - URI Absolute URI
      Returns:
        URI

    - #### removeFragment

          public static java.net.URI removeFragment(java.net.URI uri)

      Removes the fragment.
      Parameters:
        `uri` - the uri
      Returns:
        the uri

    - #### encodeUri

          public static java.lang.String encodeUri(java.lang.String uri)

      Encodes a string according to RFC 2396. According to this spec, any characters outside the range 0x20 - 0x7E must be escaped because they are not printable characters, except for characters in the fragment identifier. Even within this range a number of characters must be escaped. This method will perform this escaping.
      Parameters:
        `uri` - The URI to encode.
      Returns:
        The encoded URI.

    - #### encodeUri

          public static void encodeUri(java.lang.String uri,
                       java.lang.StringBuffer buf)

      Encodes a string according to RFC 2396.
      Parameters:
        `uri` - The URI to encode.
        `buf` - The StringBuffer that the encoded URI will be appended to.
      See Also:
        `encodeUri(java.lang.String)`

    - #### decodeUri

          public static java.lang.String decodeUri(java.lang.String uri)

      Decodes a string according to RFC 2396. According to this spec, any characters outside the range 0x20 - 0x7E must be escaped because they are not printable characters, except for any characters in the fragment identifier. This method will translate any escaped characters back to the original.
      Parameters:
        `uri` - The URI to decode.
      Returns:
        The decoded URI.

    - #### decodeUri

          public static void decodeUri(java.lang.String uri,
                       java.lang.StringBuffer buf)

      Decodes a string according to RFC 2396.
      Parameters:
        `uri` - The URI to decode.
        `buf` - The StringBuffer that the decoded URI will be appended to.
      See Also:
        `decodeUri(java.lang.String)`

    - #### decodeUriInUTF8

          public static java.lang.String decodeUriInUTF8(java.lang.String uri)

      Decode URI string and convert UTF8 encoded characters to Java string characters.
      Parameters:
        `uri` - the uri
      Returns:
        the string

    - #### packURI

          public static java.lang.String packURI(java.lang.String uri,
                                 int maxLength)

      Takes a string representation of an URI and packs it to a maximum length of maxLenght characters.
      Parameters:
        `uri` - the uri
        `maxLength` - the max length
      Returns:
        String
      Since:
        2.6.8

    - #### safeCheckIsFilePath

          public static boolean safeCheckIsFilePath(java.lang.String uri)

      Safe check is file path.
      Parameters:
        `uri` - the uri
      Returns:
        true, if successful

    - #### safeCheckIsFileUri

          public static boolean safeCheckIsFileUri(java.lang.String uri)

      Returns true if the string is a valid URI.
      Parameters:
        `uri` - the uri
      Returns:
        true, if successful

    - #### safeCheckIsHttpUri

          public static boolean safeCheckIsHttpUri(java.lang.String uri)

      Safe check is http uri.
      Parameters:
        `uri` - the uri
      Returns:
        true, if successful

    - #### safeCheckIsUriValid

          public static boolean safeCheckIsUriValid(java.lang.String uri)

      Safe check is uri valid.
      Parameters:
        `uri` - the uri
      Returns:
        true, if successful

    - #### URLtoFileName

          public static java.net.URI URLtoFileName(java.net.URL u)

      This function transforms a URL of the form file:/C:/Program Files/svs/xbrljlib-2.0.jar into a proper file URI to be used as a parameter for the File(URI) method. http://blogs.msdn.com/ie/archive/2006/12/06/file-uris-in-windows.aspx
      Parameters:
        `u` - the u
      Returns:
        the uri

    - #### resolveXBRLScheme

          public static java.lang.String resolveXBRLScheme(java.lang.String uriIsASCII)

      If the protocol of this URI is xbrl. change it to be http or file
      Parameters:
        `uriIsASCII` - the uri is ascii
      Returns:
        the string

    - #### fixFileSchemeURIToString

          public static java.lang.String fixFileSchemeURIToString(java.net.URI uri)

      If the URI passed in as a parameter is of the file: scheme, then toString does not return file:/// but file:/ This seems to be incorrect so this method just fix this. If the URI is of any other type, this method just returns the passedIn URI converted to String using URI.toString()
      Parameters:
        `uri` - the uri
      Returns:
        the string

    - #### getDetectIsURIOrFile

          public static java.net.URI getDetectIsURIOrFile(java.lang.String fileString)
                                                   throws java.net.URISyntaxException

      Detects if the input string is a file uri, a remote uri or a local file name and returns a uri pointing to the target.

      if the string starts with file: this is a local file uri. if the string starts with http: this is a remote file uri. if the string contains no scheme, then threat it as a local file in the local directory.

      Parameters:
        `fileString` - the file string
      Returns:
        the detect is uri or file
      Throws:
        `java.net.URISyntaxException` - the URI syntax exception

    - #### fixEndWithSlash

          public static java.net.URI fixEndWithSlash(java.lang.String uri)
                                              throws java.net.URISyntaxException

      Creates an URI that ends with a slash character '/' if the input string in the uri parameter does not ends with the slash character.
      Parameters:
        `uri` - the input string to create a uri from
      Returns:
        new URI just created from the string or the string after adding a trailing slash character
      Throws:
        `java.net.URISyntaxException` - in case the URI raises this exception when it is created

    - #### removeTrailingSlash

          public static java.lang.String removeTrailingSlash(java.lang.String pathName)

      Removes forward slash characters and the end of this pathName.
      Parameters:
        `pathName` - the path name
      Returns:
        the string

    - #### URItoFileString

          public static java.lang.String URItoFileString(java.lang.String path)

      If the path passed in is a URI using the file scheme, this method will return back a file name using OS conventions. In any other cases or errors during the conversion, this method returns the same path
      Parameters:
        `path` - the path
      Returns:
        path or adjusted path

    - #### makeProperFileName

          public static java.net.URI makeProperFileName(java.net.URI baseURI,
                                        XBRLRoleType role,
                                        java.lang.String extension)

      Generates an absolute file name in the same directory indicated by baseURI using the role type to extract information from it and adding the extension indicated in the extension parameter. The generated URI is absolute
      Parameters:
        `baseURI` - the base URI to resolve the file name generated.
        `role` - the role type to process and obtain information from in order to prepare a file name
        `extension` - the new file extension
      Returns:
        an absolute URI in baseURI with a generated file name from role type

    - #### makeProperFileName

          public static java.net.URI makeProperFileName(java.net.URI baseURI,
                                        DTSContainer dts,
                                        java.lang.String extension)

      Generates an absolute file name in the same directory indicated by baseURI using the role type to extract information from it and adding the extension indicated in the extension parameter. The generated URI is absolute
      Parameters:
        `baseURI` - the base URI to resolve the file name generated.
        `dts` - the DTSContainer to obtain a name from
        `extension` - the new file extension
      Returns:
        an absolute URI in baseURI with a generated file name from role type

    - #### hashResources

          public static java.lang.String hashResources()

      Hash resources.
      Returns:
        the string