MCPcopy Create free account
hub / github.com/BaseXdb/basex / encodeUri

Method encodeUri

basex-core/src/main/java/org/basex/util/Token.java:1419–1429  ·  view source on GitHub ↗

Returns a URI-encoded token. @param token token @param encoder test encoding @return encoded token

(final byte[] token, final UriEncoder encoder)

Source from the content-addressed store, hash-verified

1417 * @return encoded token
1418 */
1419 public static byte[] encodeUri(final byte[] token, final UriEncoder encoder) {
1420 final TokenBuilder tb = new TokenBuilder();
1421 for(final byte b : token) {
1422 if(letterOrDigit(b) || encoder.literal(b)) {
1423 tb.add(b);
1424 } else {
1425 tb.add('%').add(hex(b, 2));
1426 }
1427 }
1428 return tb.finish();
1429 }
1430
1431 /**
1432 * Returns a hex representation of the specified value.

Callers 8

createUrlMethod · 0.95
parsedMethod · 0.95
attributeMethod · 0.80
attributeMethod · 0.80
itemMethod · 0.80
itemMethod · 0.80
itemMethod · 0.80
itemMethod · 0.80

Calls 6

letterOrDigitMethod · 0.95
addMethod · 0.95
hexMethod · 0.95
finishMethod · 0.95
addMethod · 0.65
literalMethod · 0.45

Tested by

no test coverage detected