Class EncodingUtil


  • public class EncodingUtil
    extends java.lang.Object
    Encoding utility.
    Since:
    2.7
    • Constructor Summary

      Constructors 
      Constructor Description
      EncodingUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.net.URI encodeURL​(java.lang.String url)
      Parses and returns an encoded version of the given URL string.
      static java.lang.String encodeURLToString​(java.lang.String url)
      Parses and returns an encoded version of the given URL string.
      static java.lang.String encodeURLToString​(java.lang.String baseUrl, java.lang.String... paths)
      Parses and returns an encoded version of the given URL string alongside the given paths.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EncodingUtil

        public EncodingUtil()
    • Method Detail

      • encodeURL

        public static java.net.URI encodeURL​(java.lang.String url)
                                      throws java.net.MalformedURLException,
                                             java.net.URISyntaxException
        Parses and returns an encoded version of the given URL string.
        Parameters:
        url - Raw/decoded string form of a URL to parse/encode.
        Returns:
        Parsed/encoded URI that represents the string form URL passed in.
        Throws:
        java.net.MalformedURLException
        java.net.URISyntaxException
      • encodeURLToString

        public static java.lang.String encodeURLToString​(java.lang.String url)
        Parses and returns an encoded version of the given URL string. Wraps the MalformedURLException and URISyntaxException in case the passed URL is invalid.
        Parameters:
        url - Raw/decoded string form of a URL to parse/encode.
        Returns:
        Parsed/encoded URI (as string) that represents the
        Throws:
        java.lang.IllegalArgumentException - in case the URL string is invalid.
      • encodeURLToString

        public static java.lang.String encodeURLToString​(java.lang.String baseUrl,
                                                         java.lang.String... paths)
        Parses and returns an encoded version of the given URL string alongside the given paths.
        Parameters:
        baseUrl - Base URL to use when constructing the final URL, ie: scheme://authority/initial.path.
        paths - Additional path(s) to append at the end of the base path.
        Returns:
        Composed URL (base + paths) already encoded, separating the individual path components by "/".
        Since:
        TODO