@Test public void testCreatePrefix() throws Exception { assertEquals(ipPrefix1, IpPrefixConv.createPrefix("127.0.0.1/32")); assertEquals(ipPrefix2, IpPrefixConv.createPrefix("0.0.0.0/16")); assertEquals(ipPrefix2, IpPrefixConv.createPrefix("/0.0.0.0/16")); assertEquals(ipPrefix3, IpPrefixConv.createPrefix("2001:db8:0:0:0:0:0:1/128")); assertEquals(ipPrefix4, IpPrefixConv.createPrefix("2001:d8:0:0:0:0:0:0/32")); }
public static IpPrefix createPrefix(String ipPrefix) throws UnknownPrefixException { if (ipPrefix == null || ipPrefix.isEmpty()) { throw new UnknownPrefixException("Not defined [\"" + ipPrefix + "\"]"); } if (ipPrefix.startsWith("/")) { ipPrefix = ipPrefix.substring(1); } return IpPrefixBuilder.getDefaultInstance(ipPrefix); }
IpPrefixConv { public static IpPrefix createPrefix(String ipPrefix) throws UnknownPrefixException { if (ipPrefix == null || ipPrefix.isEmpty()) { throw new UnknownPrefixException("Not defined [\"" + ipPrefix + "\"]"); } if (ipPrefix.startsWith("/")) { ipPrefix = ipPrefix.substring(1); } return IpPrefixBuilder.getDefaultInstance(ipPrefix); } }
IpPrefixConv { public static IpPrefix createPrefix(String ipPrefix) throws UnknownPrefixException { if (ipPrefix == null || ipPrefix.isEmpty()) { throw new UnknownPrefixException("Not defined [\"" + ipPrefix + "\"]"); } if (ipPrefix.startsWith("/")) { ipPrefix = ipPrefix.substring(1); } return IpPrefixBuilder.getDefaultInstance(ipPrefix); } private  IpPrefixConv(); }
IpPrefixConv { public static IpPrefix createPrefix(String ipPrefix) throws UnknownPrefixException { if (ipPrefix == null || ipPrefix.isEmpty()) { throw new UnknownPrefixException("Not defined [\"" + ipPrefix + "\"]"); } if (ipPrefix.startsWith("/")) { ipPrefix = ipPrefix.substring(1); } return IpPrefixBuilder.getDefaultInstance(ipPrefix); } private  IpPrefixConv(); static IpPrefix createPrefix(String ipPrefix); static List<IpPrefix> decodeIpv4(byte[] array, boolean compact); static List<IpPrefix> decodeIpv6(byte[] array, boolean compact); static boolean equalTo(IpPrefix prefix1, IpPrefix prefix2); static int getBytesLength(int prefixLength); static int getPrefixLength(IpPrefix ipPrefix); static InetSocketAddress parseInetPrefix(String ipPrefix); static byte[] toBytes(IpPrefix prefix); static byte[] toBytes(List<IpPrefix> prefixes); static String toString(IpPrefix prefix); static String toString(List<IpPrefix> prefixes); static byte[] trimPrefix(byte[] prefix, int blength); }
IpPrefixConv { public static IpPrefix createPrefix(String ipPrefix) throws UnknownPrefixException { if (ipPrefix == null || ipPrefix.isEmpty()) { throw new UnknownPrefixException("Not defined [\"" + ipPrefix + "\"]"); } if (ipPrefix.startsWith("/")) { ipPrefix = ipPrefix.substring(1); } return IpPrefixBuilder.getDefaultInstance(ipPrefix); } private  IpPrefixConv(); static IpPrefix createPrefix(String ipPrefix); static List<IpPrefix> decodeIpv4(byte[] array, boolean compact); static List<IpPrefix> decodeIpv6(byte[] array, boolean compact); static boolean equalTo(IpPrefix prefix1, IpPrefix prefix2); static int getBytesLength(int prefixLength); static int getPrefixLength(IpPrefix ipPrefix); static InetSocketAddress parseInetPrefix(String ipPrefix); static byte[] toBytes(IpPrefix prefix); static byte[] toBytes(List<IpPrefix> prefixes); static String toString(IpPrefix prefix); static String toString(List<IpPrefix> prefixes); static byte[] trimPrefix(byte[] prefix, int blength);  }