Class URLCoder


  • public class URLCoder
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      URLCoder()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String decode​(java.lang.String s)
      Decode a string from a URL.
      This method uses StandardCharsets.UTF_8 as charset.
      static java.lang.String decode​(java.lang.String s, java.nio.charset.Charset charset)
      Decode a string from a URL.
      static java.lang.String encode​(java.lang.String s)
      Encode a string to be used in a URL.
      This method uses StandardCharsets.UTF_8 as charset.
      static java.lang.String encode​(java.lang.String s, java.nio.charset.Charset charset)
      Encode a string to be used in a URL.
      • Methods inherited from class java.lang.Object

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

      • URLCoder

        public URLCoder()
    • Method Detail

      • encode

        public static java.lang.String encode​(java.lang.String s)
        Encode a string to be used in a URL.
        This method uses StandardCharsets.UTF_8 as charset.
        Parameters:
        s - The string to encode
        Returns:
        The encoded string
      • encode

        public static java.lang.String encode​(java.lang.String s,
                                              java.nio.charset.Charset charset)
        Encode a string to be used in a URL.
        Parameters:
        s - The string to encode
        charset - The charset to use
        Returns:
        The encoded string
      • decode

        public static java.lang.String decode​(java.lang.String s)
        Decode a string from a URL.
        This method uses StandardCharsets.UTF_8 as charset.
        Parameters:
        s - The string to decode
        Returns:
        The decoded string
      • decode

        public static java.lang.String decode​(java.lang.String s,
                                              java.nio.charset.Charset charset)
        Decode a string from a URL.
        Parameters:
        s - The string to decode
        charset - The charset to use
        Returns:
        The decoded string