Class GrpcUtil.AuthorityEscaper

java.lang.Object
io.grpc.internal.GrpcUtil.AuthorityEscaper
Enclosing class:
GrpcUtil

public static class GrpcUtil.AuthorityEscaper extends Object
Percent encode the authority based on https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.

When escaping a String, the following rules apply:

  • The alphanumeric characters "a" through "z", "A" through "Z" and "0" through "9" remain the same.
  • The unreserved characters ".", "-", "~", and "_" remain the same.
  • The general delimiters for authority, "[", "]", "@" and ":" remain the same.
  • The subdelimiters "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", and "=" remain the same.
  • The space character " " is converted into %20.
  • All other characters are converted into one or more bytes using UTF-8 encoding and each byte is then represented by the 3-character string "%XY", where "XY" is the two-digit, uppercase, hexadecimal representation of the byte value.

This section does not use URLEscapers from Guava Net as its not Android-friendly thus core can't depend on it.

  • Constructor Details

    • AuthorityEscaper

      public AuthorityEscaper()
  • Method Details

    • encodeAuthority

      public static String encodeAuthority(String authority)