Package io.grpc.internal
Class GrpcUtil.AuthorityEscaper
- java.lang.Object
-
- io.grpc.internal.GrpcUtil.AuthorityEscaper
-
- Enclosing class:
- GrpcUtil
public static class GrpcUtil.AuthorityEscaper extends java.lang.Object
Percent encode theauthority
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
Fields Modifier and Type Field Description private static java.util.Set<java.lang.Character>
AUTHORITY_DELIMS
private static java.util.Set<java.lang.Character>
SUB_DELIMS
private static java.util.Set<java.lang.Character>
UNRESERVED_CHARACTERS
private static char[]
UPPER_HEX_DIGITS
-
Constructor Summary
Constructors Constructor Description AuthorityEscaper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
encodeAuthority(java.lang.String authority)
private static boolean
shouldEscape(char c)
-
-
-
Field Detail
-
UPPER_HEX_DIGITS
private static final char[] UPPER_HEX_DIGITS
-
UNRESERVED_CHARACTERS
private static final java.util.Set<java.lang.Character> UNRESERVED_CHARACTERS
-
SUB_DELIMS
private static final java.util.Set<java.lang.Character> SUB_DELIMS
-
AUTHORITY_DELIMS
private static final java.util.Set<java.lang.Character> AUTHORITY_DELIMS
-
-