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

Method increment

output/java_guava/1.4.19/InetAddresses.java:986–996  ·  view source on GitHub ↗

Returns a new InetAddress that is one more than the passed in address. This method works for both IPv4 and IPv6 addresses. @param address the InetAddress to increment @return a new InetAddress that is one more than the passed in address @throws IllegalArgumentException if InetAddress is at the end

(InetAddress address)

Source from the content-addressed store, hash-verified

984
985
986 public static InetAddress increment(InetAddress address) {
987 byte[] addr = address.getAddress();
988 int i = addr.length - 1;
989 while (i >= 0 && addr[i] == (byte) 0xff) {
990 addr[i] = 0;
991 i--;
992 }
993 Preconditions.checkArgument(i >= 0, "Incrementing %s would wrap.", address);
994 addr[i]++;
995 return bytesToInetAddress(addr);
996 }
997
998 /**
999 * Returns true if the InetAddress is either 255.255.255.255 for IPv4 or

Callers

nothing calls this directly

Calls 2

checkArgumentMethod · 0.95
bytesToInetAddressMethod · 0.95

Tested by

no test coverage detected