Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need to expand ipv6 address to its full form  RSS feed

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am searching , searching and searching to find a utility method that can take a compressed ipv6 address, and return me the same in the full uncompressed format. Kindly let me know if theres is any?
So far no success
 
Ranch Hand
Posts: 90
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It will be a little hard to find java code that does that. But from what I understand by ipv6 address compression is removal of unnecessary preceeding zeroes from the address section and replacing a series of zeroes by :: . I guess if you understand ipv6 address compression, the logic for converting it into uncompressed form is not that hard. I tried to make a small function for you that does it.



I hope this is what you meant.

Inputting this: FFED::A98:3210:4562
will give this : FFED:0000:0000:0000:0000:0A98:3210:4562

tweak this function to make it a little more sophisticated if you need validation or if you have other things to consider. I wrote this function in a hurry, test it before you use it.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!