MCPcopy Create free account
hub / github.com/antlr/codebuff / toString

Method toString

corpus/java/training/guava/net/HostAndPort.java:300–313  ·  view source on GitHub ↗

Rebuild the host:port string, including brackets if necessary.

()

Source from the content-addressed store, hash-verified

298
299 /** Rebuild the host:port string, including brackets if necessary. */
300 @Override
301 public String toString() {
302 // "[]:12345" requires 8 extra bytes.
303 StringBuilder builder = new StringBuilder(host.length() + 8);
304 if (host.indexOf(':') >= 0) {
305 builder.append('[').append(host).append(']');
306 } else {
307 builder.append(host);
308 }
309 if (hasPort()) {
310 builder.append(':').append(port);
311 }
312 return builder.toString();
313 }
314
315 /** Return true for valid port numbers. */
316 private static boolean isValidPort(int port) {

Callers

nothing calls this directly

Calls 5

hasPortMethod · 0.95
toStringMethod · 0.65
lengthMethod · 0.45
indexOfMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected