wikier
wikier

Reputation: 2565

Open source IPv6 Java validation

Now that all sun.* proprietary APIs may be removed in the future, does anyone know any open source Java implementation of IPv6 validation?

Regarding this question, it'd be also nice to have native ipv6-address/prefix-length format support to.

Upvotes: 3

Views: 617

Answers (2)

Sean F
Sean F

Reputation: 4595

The open-source IPAddress Java library will validate both IPv6 and IPv4 and also supports prefix-length (and validation of such). I am the project manager of that library.

Use

try {
    IPAddressString str = new IPAddressString("::1");
    IPAddress addr = str.toAddress();
} catch(IPAddressStringException e) {
    //e.getMessage has validation error
}

Upvotes: 1

stan
stan

Reputation: 1014

See the Guava library (there is isInetAddress() method)

Upvotes: 1

Related Questions