@Test(expected = IllegalArgumentException.class) public void invalidCidrNotationInvalidIpV4() { NetworkAddress.parseBlock("10.267.10.10/"); }
public static NetworkAddress parseBlock(String networkAddress) { NetworkAddress address = null; if (networkAddress != null) { String[] split = networkAddress.split("/"); if (split.length == 2) { byte[] network = parseDottedQuad(split[0]); byte bits = Byte.parseByte(split[1]); address = toNetworkAddress(network, toNetworkMask(bits)); } else { throw new IllegalArgumentException("Network address must be ip4Address/prefixSize"); } } return address; }
NetworkAddress { public static NetworkAddress parseBlock(String networkAddress) { NetworkAddress address = null; if (networkAddress != null) { String[] split = networkAddress.split("/"); if (split.length == 2) { byte[] network = parseDottedQuad(split[0]); byte bits = Byte.parseByte(split[1]); address = toNetworkAddress(network, toNetworkMask(bits)); } else { throw new IllegalArgumentException("Network address must be ip4Address/prefixSize"); } } return address; } }
NetworkAddress { public static NetworkAddress parseBlock(String networkAddress) { NetworkAddress address = null; if (networkAddress != null) { String[] split = networkAddress.split("/"); if (split.length == 2) { byte[] network = parseDottedQuad(split[0]); byte bits = Byte.parseByte(split[1]); address = toNetworkAddress(network, toNetworkMask(bits)); } else { throw new IllegalArgumentException("Network address must be ip4Address/prefixSize"); } } return address; } private  NetworkAddress(byte[] network, byte[] netmask); }
NetworkAddress { public static NetworkAddress parseBlock(String networkAddress) { NetworkAddress address = null; if (networkAddress != null) { String[] split = networkAddress.split("/"); if (split.length == 2) { byte[] network = parseDottedQuad(split[0]); byte bits = Byte.parseByte(split[1]); address = toNetworkAddress(network, toNetworkMask(bits)); } else { throw new IllegalArgumentException("Network address must be ip4Address/prefixSize"); } } return address; } private  NetworkAddress(byte[] network, byte[] netmask); @Override String toString(); boolean isAddressInNetwork(String address); static NetworkAddress parse(String networkAddress); static NetworkAddress parseBlock(String networkAddress); static boolean isValidIPAddress(String networkAddress); }
NetworkAddress { public static NetworkAddress parseBlock(String networkAddress) { NetworkAddress address = null; if (networkAddress != null) { String[] split = networkAddress.split("/"); if (split.length == 2) { byte[] network = parseDottedQuad(split[0]); byte bits = Byte.parseByte(split[1]); address = toNetworkAddress(network, toNetworkMask(bits)); } else { throw new IllegalArgumentException("Network address must be ip4Address/prefixSize"); } } return address; } private  NetworkAddress(byte[] network, byte[] netmask); @Override String toString(); boolean isAddressInNetwork(String address); static NetworkAddress parse(String networkAddress); static NetworkAddress parseBlock(String networkAddress); static boolean isValidIPAddress(String networkAddress);  }