public class URITools
extends java.lang.Object
| Constructor and Description |
|---|
URITools() |
| 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.
|
public static java.net.URI getNormalURI(java.net.URI sinonimURI)
sinonimURI - the sinonim uripublic static boolean areSameUri(java.net.URI uri1,
java.net.URI uri2)
uri1 - the uri1uri2 - the uri2public static java.net.URI makeAbsolute(java.net.URI base,
java.net.URI uri)
base - the baseuri - the uripublic static java.net.URI relativize(java.net.URI base,
java.net.URI full)
base - URIfull - URIpublic static java.net.URI relativizeMore(java.net.URI from,
java.net.URI to)
from - URI Absolute URIto - URI Absolute URIpublic static java.net.URI removeFragment(java.net.URI uri)
uri - the uripublic static java.lang.String encodeUri(java.lang.String uri)
uri - The URI to encode.public static void encodeUri(java.lang.String uri,
java.lang.StringBuffer buf)
uri - The URI to encode.buf - The StringBuffer that the encoded URI will be appended to.encodeUri(java.lang.String)public static java.lang.String decodeUri(java.lang.String uri)
uri - The URI to decode.public static void decodeUri(java.lang.String uri,
java.lang.StringBuffer buf)
uri - The URI to decode.buf - The StringBuffer that the decoded URI will be appended to.decodeUri(java.lang.String)public static java.lang.String decodeUriInUTF8(java.lang.String uri)
uri - the uripublic static java.lang.String packURI(java.lang.String uri,
int maxLength)
uri - the urimaxLength - the max lengthpublic static boolean safeCheckIsFilePath(java.lang.String uri)
uri - the uripublic static boolean safeCheckIsFileUri(java.lang.String uri)
uri - the uripublic static boolean safeCheckIsHttpUri(java.lang.String uri)
uri - the uripublic static boolean safeCheckIsUriValid(java.lang.String uri)
uri - the uripublic static java.net.URI URLtoFileName(java.net.URL u)
u - the upublic static java.lang.String resolveXBRLScheme(java.lang.String uriIsASCII)
uriIsASCII - the uri is asciipublic static java.lang.String fixFileSchemeURIToString(java.net.URI uri)
uri - the uripublic static java.net.URI getDetectIsURIOrFile(java.lang.String fileString)
throws java.net.URISyntaxException
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.
fileString - the file stringjava.net.URISyntaxException - the URI syntax exceptionpublic static java.net.URI fixEndWithSlash(java.lang.String uri)
throws java.net.URISyntaxException
uri - the input string to create a uri fromjava.net.URISyntaxException - in case the URI raises this exception when it is createdpublic static java.lang.String removeTrailingSlash(java.lang.String pathName)
pathName - the path namepublic static java.lang.String URItoFileString(java.lang.String path)
path - the pathpublic static java.net.URI makeProperFileName(java.net.URI baseURI,
XBRLRoleType role,
java.lang.String extension)
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 nameextension - the new file extensionpublic static java.net.URI makeProperFileName(java.net.URI baseURI,
DTSContainer dts,
java.lang.String extension)
baseURI - the base URI to resolve the file name generated.dts - the DTSContainer to obtain a name fromextension - the new file extensionpublic static java.lang.String hashResources()