tags:

views:

541

answers:

3

I'm looking for a Java library that is geared towards network math and already tested. Nothing particularly fancy, just something to hold ips and subnets, and do things like print a subnet mask or calculate whether an IP is within a given subnet.

Should I roll my own, or is there already a robust library for this?

+2  A: 

org.apache.lenya.ac.IPRange appears to have these features.

The Apache Lenya project is an open-source content management system. It uses the Apache License, so you may be able to reuse just the code you need. (But as always, read the license yourself; don't trust legal advice from some guy on the internet! :-)

Bill Karwin
A: 

org.apache.lenya.ac.IPRange can certainly be modified to meet my needs, thanks for the response.

That said, I was hoping to find something more general, like a Java equivalent to Perl's IP::NetAddr.

perilandmishap
+1  A: 

We developed a Java IPv4 arithmetic library ourselves. See it here: http://tufar.com/ipcalculator/ It is under BSD license.

Nicolai Tufar