MCPcopy Create free account
hub / github.com/grpc/grpc-java / percentDecode

Method percentDecode

api/src/main/java/io/grpc/Uri.java:1057–1063  ·  view source on GitHub ↗

Decodes a string of characters in the range [U+0000, U+007F] to bytes. Each percent-encoded sequence (e.g. "%F0" or "%2a", as defined by RFC 3986 2.1) is decoded to the octet it encodes. Other characters are decoded to their code point's single byte value. A literal % character must be encoded a

(CharSequence s)

Source from the content-addressed store, hash-verified

1055 * encoding sequences.
1056 */
1057 public static ByteBuffer percentDecode(CharSequence s) {
1058 // This is large enough because each input character needs *at most* one byte of output.
1059 ByteBuffer outBuf = ByteBuffer.allocate(s.length());
1060 percentDecode(s, "input", null, outBuf);
1061 outBuf.flip();
1062 return outBuf;
1063 }
1064
1065 private static void percentDecode(
1066 CharSequence s, String what, BitSet allowedChars, ByteBuffer outBuf) {

Callers 2

Calls 3

allocateMethod · 0.65
putMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected