Class UriUtils


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

      Constructors 
      Constructor Description
      UriUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String decode​(java.lang.String value, java.nio.charset.Charset charset)
      Uri Decode the value.
      static java.lang.String encode​(java.lang.String value)
      Uri Encode the value, using the default Charset.
      static java.lang.String encode​(java.lang.String value, java.nio.charset.Charset charset)
      Uri Encode the value.
      static java.lang.String encodeReserved​(java.lang.String value, java.lang.String reserved, java.nio.charset.Charset charset)
      Encodes the value, preserving all reserved characters..
      static boolean isAbsolute​(java.lang.String uri)
      Determines if the provided uri is an absolute uri.
      static boolean isEncoded​(java.lang.String value)
      Determines if the value is already pct-encoded.
      static java.lang.String pathEncode​(java.lang.String path, java.nio.charset.Charset charset)
      Uri Encode a Path Fragment.
      static java.lang.String queryEncode​(java.lang.String query, java.nio.charset.Charset charset)
      Uri Encode a Query Fragment.
      • Methods inherited from class java.lang.Object

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

      • UriUtils

        public UriUtils()
    • Method Detail

      • isEncoded

        public static boolean isEncoded​(java.lang.String value)
        Determines if the value is already pct-encoded.
        Parameters:
        value - to check.
        Returns:
        true if the value is already pct-encoded
      • encode

        public static java.lang.String encode​(java.lang.String value)
        Uri Encode the value, using the default Charset. Already encoded values are skipped.
        Parameters:
        value - to encode.
        Returns:
        the encoded value.
      • encode

        public static java.lang.String encode​(java.lang.String value,
                                              java.nio.charset.Charset charset)
        Uri Encode the value. Already encoded values are skipped.
        Parameters:
        value - to encode.
        charset - to use.
        Returns:
        the encoded value.
      • decode

        public static java.lang.String decode​(java.lang.String value,
                                              java.nio.charset.Charset charset)
        Uri Decode the value.
        Parameters:
        value - to decode
        charset - to use.
        Returns:
        the decoded value.
      • pathEncode

        public static java.lang.String pathEncode​(java.lang.String path,
                                                  java.nio.charset.Charset charset)
        Uri Encode a Path Fragment.
        Parameters:
        path - containing the path fragment.
        charset - to use.
        Returns:
        the encoded path fragment.
      • queryEncode

        public static java.lang.String queryEncode​(java.lang.String query,
                                                   java.nio.charset.Charset charset)
        Uri Encode a Query Fragment.
        Parameters:
        query - containing the query fragment
        charset - to use.
        Returns:
        the encoded query fragment.
      • isAbsolute

        public static boolean isAbsolute​(java.lang.String uri)
        Determines if the provided uri is an absolute uri.
        Parameters:
        uri - to evaluate.
        Returns:
        true if the uri is absolute.
      • encodeReserved

        public static java.lang.String encodeReserved​(java.lang.String value,
                                                      java.lang.String reserved,
                                                      java.nio.charset.Charset charset)
        Encodes the value, preserving all reserved characters.. Values that are already pct-encoded are ignored.
        Parameters:
        value - inspect.
        reserved - characters to preserve.
        charset - to use.
        Returns:
        a new String with the reserved characters preserved.