Get Ipv6 Full Format In Java -
i have ipv6 like:"2001:cdba::3257:9652". want ipv6 in full format like: 2001:cdba:0000:0000:0000:0000:3257:9652. has function in java that? , how compress ipv6 full format? all.
there no method in standard java libraries that.
the ipaddress java library has methods produce formats , various other string formats.
here code sample:
ipaddressstring addrstring = new ipaddressstring("2001:cdba::3257:9652"); ipaddress addr = addrstring.getaddress(); string string = addr.tofullstring(); system.out.println(string); string = addr.tocanonicalstring(); system.out.println(string);
the output is:
2001:cdba:0000:0000:0000:0000:3257:9652 2001:cdba::3257:9652
Comments
Post a Comment