package org.opendaylight.protocol.concepts;
import java.net.Inet6Address;
-import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Collections;
import java.util.List;
}
}
- public static byte[] bytesForAddress(final Ipv6Address address) {
- Inet6Address a;
- try {
- a = (Inet6Address) InetAddress.getByName(address.getValue());
- } catch (final UnknownHostException e) {
- throw new IllegalArgumentException(e.getMessage());
- }
- return a.getAddress();
- }
-
public static Ipv6Prefix prefixForBytes(final byte[] bytes, final int length) {
Preconditions.checkArgument(length <= bytes.length * 8);
return new Ipv6Prefix(addressForBytes(bytes).toString() + "/" + length);