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

Method increment

output/java_guava/1.4.16/InetAddresses.java:985–995  ·  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

983
984
985 public static InetAddress increment(InetAddress address) {
986 byte[] addr = address.getAddress();
987 int i = addr.length - 1;
988 while (i >= 0 && addr[i] == (byte) 0xff) {
989 addr[i] = 0;
990 i--;
991 }
992 Preconditions.checkArgument(i >= 0, "Incrementing %s would wrap.", address);
993 addr[i]++;
994 return bytesToInetAddress(addr);
995 }
996
997 /**
998 * 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