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

Method decrement

output/java_guava/1.4.19/InetAddresses.java:963–973  ·  view source on GitHub ↗

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

(InetAddress address)

Source from the content-addressed store, hash-verified

961
962
963 public static InetAddress decrement(InetAddress address) {
964 byte[] addr = address.getAddress();
965 int i = addr.length - 1;
966 while (i >= 0 && addr[i] == (byte) 0x00) {
967 addr[i] = (byte) 0xff;
968 i--;
969 }
970 Preconditions.checkArgument(i >= 0, "Decrementing %s would wrap.", address);
971 addr[i]--;
972 return bytesToInetAddress(addr);
973 }
974
975 /**
976 * Returns a new InetAddress that is one more than the passed in address. This method works for

Callers

nothing calls this directly

Calls 2

checkArgumentMethod · 0.95
bytesToInetAddressMethod · 0.95

Tested by

no test coverage detected