Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

There is any java API to to validate IP6 and IP4 Address?  RSS feed

 
chaohua wang
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,

I have 2 type (IP4 and IP6) Address data,which are String.
IP4 : "15.2.3.56" format
IP6: "1080:0:0:0:8:800:200C:417A" format.

I wonder if there is any java API to validate them? so I don't have to write a code to it using StringTokenize.

Thank you!

Chwang
 
Stephan van Hulst
Saloon Keeper
Posts: 7815
142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the InetAddress class, in java.net.*.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!