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

Method findPortStartColon

api/src/main/java/io/grpc/Uri.java:283–300  ·  view source on GitHub ↗
(String authority, int hostStart)

Source from the content-addressed store, hash-verified

281 }
282
283 private static int findPortStartColon(String authority, int hostStart) {
284 for (int i = authority.length() - 1; i >= hostStart; --i) {
285 char c = authority.charAt(i);
286 if (c == ':') {
287 return i;
288 }
289 if (c == ']') {
290 // Hit the end of IP-literal. Any further colon is inside it and couldn't indicate a port.
291 break;
292 }
293 if (!digitChars.get(c)) {
294 // Found a non-digit, non-colon, non-bracket.
295 // This means there is no valid port (e.g. host is "example.com")
296 break;
297 }
298 }
299 return -1;
300 }
301
302 // Checks a raw path for validity and parses it into segments. Let 'out' be null to just validate.
303 private static void parseAssumedUtf8PathIntoSegments(

Callers 1

setRawAuthorityMethod · 0.80

Calls 1

getMethod · 0.65

Tested by

no test coverage detected