public class IpRangeHelper extends Object
| Modifier and Type | Method and Description | 
|---|---|
| static String | byteToString(byte[] value)Transform byte array to ipv6 notation. | 
| static BigInteger | getBroadcastAddress(BigInteger ip,
                   BigInteger netmask)Gets the broadcast address. | 
| static BigInteger | getNetAddress(BigInteger ip,
             BigInteger netmask)Gets the net address. | 
| static BigInteger | getSubNetMask(int bits)Gets the bit mask. | 
| static BigInteger | getSubNetMask(String ip)Gets the sub net mask for the given ip. | 
| static boolean | ipInRange(BigInteger ip,
         BigInteger start,
         BigInteger end)Checks if if the IP is in range. | 
| static boolean | ipInRange(String ip,
         String start,
         String end)Checks if if the IP is in range. | 
| static BigInteger | ipToInt(String ip)Transform the given ipv6 address to 128 bit integer. | 
| static String | ipToString(BigInteger ip)Transform the given 128 bit value to ipv6 notation. | 
| static String | rangesToString(Collection<IpRange> ranges,
              String delimiter)Transform ranges to string. | 
| static IpRange | stringToRange(String iprange)Parse an iP range. | 
| static List<IpRange> | stringToRanges(String text,
              String delimiter)Parses multiple IP ranges. | 
| static boolean | validateIP(String ip)Validate ip. | 
public static String byteToString(byte[] value)
value - the byte arraypublic static BigInteger getBroadcastAddress(BigInteger ip, BigInteger netmask)
ip - the ipnetmask - the netmaskpublic static BigInteger getNetAddress(BigInteger ip, BigInteger netmask)
ip - the ipnetmask - the netmaskpublic static BigInteger getSubNetMask(int bits)
bits - the bits to setpublic static BigInteger getSubNetMask(String ip)
ip - the ippublic static boolean ipInRange(BigInteger ip, BigInteger start, BigInteger end)
ip - the ipstart - the start of the rangeend - the end of the rangepublic static boolean ipInRange(String ip, String start, String end) throws InvalidIpRangeException, InvalidIpAddressException
ip - the ipstart - the start of the rangeend - the end of the rangeInvalidIpRangeException - the invalid IP range exceptionInvalidIpAddressException - the invalid IP address exceptionpublic static BigInteger ipToInt(String ip) throws InvalidIpAddressException
ip - the ipInvalidIpAddressException - the invalid IP address exceptionpublic static String ipToString(BigInteger ip)
ip - the ippublic static String rangesToString(Collection<IpRange> ranges, String delimiter)
ranges - the rangesdelimiter - the delimiterpublic static IpRange stringToRange(String iprange) throws InvalidIpRangeException, InvalidIpAddressException
iprange - the iprangeInvalidIpRangeException - the invalid IP range exceptionInvalidIpAddressException - the invalid IP address exceptionpublic static List<IpRange> stringToRanges(String text, String delimiter) throws InvalidIpRangeException, InvalidIpAddressException
text - the textdelimiter - the delimiterInvalidIpRangeException - the invalid IP range exceptionInvalidIpAddressException - the invalid IP address exceptionpublic static boolean validateIP(String ip)
ip - the ipCopyright © 2019 Communote team. All rights reserved.