org.nbnResolving.common

Class URNUtils

Parameters:
map1 - First map.
map2 - Second map.
Returns:
A Java map containing all elements of two given maps.
Throws:
UnsupportedEncodingException
See Also:
TreeMap, URLDecoder, URLEncoder
  • correctUtf8error

    public static String correctUtf8error(String strToCorrect)
                                   throws UnsupportedEncodingException
    Corrects wrong converted or encoded strings. This version only works for false encoded UTF-8 strings to correct Latin1 strings
    Parameters:
    strToCorrect - String to check.
    Returns:
    Corrected String.
    Throws:
    UnsupportedEncodingException
  • correctUrlString

    public static String correctUrlString(String urlStr,
                          boolean correctEncoding,
                          boolean checkJavaURI)
    Tries to return a RFC compatible, normalized URL as string from a given string.
    Parameters:
    urlStr - URL to correct as string.
    correctEncoding - Try to correct common wrong Latin1 - UTF-8 conversions.
    checkJavaURI - Check if Java can parse this string as Java URL and URI without exception
    Returns:
    Corrected URL as string. "http://www.w3.org/TR/html401"
  • normalize

    public static String normalize(String str,
                   boolean lowerCase)
                            throws UnsupportedEncodingException
    Normalizes the "Percent Encoding" of an URI
    Parameters:
    str - The URI to normalize as Java String
    lowerCase - TRUE if the string should be converted to all lower case.
    Returns:
    URL as normalized string.
    Throws:
    UnsupportedEncodingException

Copyright © 2014 Deutsche Nationalbibliothek / German National Library. All rights reserved.