net.clackrouter.netutils
Class NetUtils
java.lang.Object
net.clackrouter.netutils.NetUtils
public class NetUtils
- extends java.lang.Object
Simple utilities for operating on ByteBuffers and Internet Addresses.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NetUtils
public NetUtils()
Inet2ByteBuffer
public static java.nio.ByteBuffer Inet2ByteBuffer(java.lang.String in)
Inet2ByteBuffer
public static java.nio.ByteBuffer Inet2ByteBuffer(java.net.InetAddress in)
ByteBuffer2Inet
public static java.net.InetAddress ByteBuffer2Inet(java.nio.ByteBuffer in)
NetworkAndMaskToString
public static java.lang.String NetworkAndMaskToString(java.net.InetAddress net,
java.net.InetAddress mask)
getNumMaskBits
public static int getNumMaskBits(java.net.InetAddress mask)
NetworkAndMaskFromString
public static NetUtils.Net NetworkAndMaskFromString(java.lang.String s)
throws java.lang.Exception
- Throws:
java.lang.Exception
getIntFromAddr
public static int getIntFromAddr(java.net.InetAddress in)
getLongFromAddr
public static long getLongFromAddr(java.net.InetAddress in)
isNetworkMatch
public static boolean isNetworkMatch(java.net.InetAddress testIp,
java.net.InetAddress network,
java.net.InetAddress netmask)
intToInetAddress
public static java.net.InetAddress intToInetAddress(long addr)
applyNetMask
public static java.net.InetAddress applyNetMask(java.net.InetAddress addr,
java.net.InetAddress mask)
throws java.lang.Exception
- Throws:
java.lang.Exception
getMaxAddressInSubnet
public static java.net.InetAddress getMaxAddressInSubnet(java.net.InetAddress network,
java.net.InetAddress netmask)