Package io.grpc.internal
Class GrpcUtil.AuthorityEscaper
java.lang.Object
io.grpc.internal.GrpcUtil.AuthorityEscaper
- Enclosing class:
GrpcUtil
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final char[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
encodeAuthority
(String authority) private static boolean
shouldEscape
(char c)
-
Field Details
-
UPPER_HEX_DIGITS
private static final char[] UPPER_HEX_DIGITS -
UNRESERVED_CHARACTERS
-
SUB_DELIMS
-
AUTHORITY_DELIMS
-
-
Constructor Details
-
AuthorityEscaper
public AuthorityEscaper()
-
-
Method Details
-
shouldEscape
private static boolean shouldEscape(char c) -
encodeAuthority
-