@Test public void testToString() throws Exception { assertEquals("127.0.0.1/32", IpPrefixConv.toString(ipPrefix1)); assertEquals("0.0.0.0/16", IpPrefixConv.toString(ipPrefix2)); assertEquals("2001:db8:0:0:0:0:0:1/128", IpPrefixConv.toString(ipPrefix3)); assertEquals("2001:d8:0:0:0:0:0:0/32", IpPrefixConv.toString(ipPrefix4)); IpPrefix pref = null; assertEquals("", IpPrefixConv.toString(pref)); List<IpPrefix> prefList = null; assertEquals("", IpPrefixConv.toString(prefList)); assertEquals("127.0.0.1/32,0.0.0.0/16,2001:db8:0:0:0:0:0:1/128,2001:d8:0:0:0:0:0:0/32", IpPrefixConv.toString(ipPrefixes)); }
public static String toString(IpPrefix prefix) { if (prefix == null) { return ""; } String result = prefix.stringValue(); if (result.startsWith("/")) { result = result.substring(1); } return result; }
IpPrefixConv { public static String toString(IpPrefix prefix) { if (prefix == null) { return ""; } String result = prefix.stringValue(); if (result.startsWith("/")) { result = result.substring(1); } return result; } }
IpPrefixConv { public static String toString(IpPrefix prefix) { if (prefix == null) { return ""; } String result = prefix.stringValue(); if (result.startsWith("/")) { result = result.substring(1); } return result; } private  IpPrefixConv(); }
IpPrefixConv { public static String toString(IpPrefix prefix) { if (prefix == null) { return ""; } String result = prefix.stringValue(); if (result.startsWith("/")) { result = result.substring(1); } return result; } 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 String toString(IpPrefix prefix) { if (prefix == null) { return ""; } String result = prefix.stringValue(); if (result.startsWith("/")) { result = result.substring(1); } return result; } 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);  }