public class IPTools extends Object
Example usage scenarios:
Copyright (c) 2002-2023 IP2Location.com
| Constructor and Description |
|---|
IPTools() |
| Modifier and Type | Method and Description |
|---|---|
String[] |
CIDRToIPv4(String CIDR)
This function returns the IPv4 range for a CIDR.
|
String[] |
CIDRToIPv6(String CIDR)
This function returns the IPv6 range for a CIDR.
|
String |
CompressIPv6(String IPAddress)
This function returns the compressed form of the IPv6.
|
String |
DecimalToIPv4(BigInteger IPNum)
This function converts IP number to IPv4.
|
String |
DecimalToIPv6(BigInteger IPNum)
This function converts IP number to IPv6.
|
String |
ExpandIPv6(String IPAddress)
This function returns the expanded form of the IPv6.
|
List<String> |
IPv4ToCIDR(String IPFrom,
String IPTo)
This function returns the CIDR for an IPv4 range.
|
BigInteger |
IPv4ToDecimal(String IPAddress)
This function converts IPv4 to IP number.
|
List<String> |
IPv6ToCIDR(String IPFrom,
String IPTo)
This function returns the CIDR for an IPv6 range.
|
BigInteger |
IPv6ToDecimal(String IPAddress)
This function converts IPv6 to IP number.
|
boolean |
IsIPv4(String IPAddress)
This function checks if the string contains an IPv4 address.
|
boolean |
IsIPv6(String IPAddress)
This function checks if the string contains an IPv6 address.
|
public boolean IsIPv4(String IPAddress)
IPAddress - IP Address to checkpublic boolean IsIPv6(String IPAddress)
IPAddress - IP Address to checkpublic BigInteger IPv4ToDecimal(String IPAddress)
IPAddress - IP Address you wish to convertpublic BigInteger IPv6ToDecimal(String IPAddress)
IPAddress - IP Address you wish to convertpublic String DecimalToIPv4(BigInteger IPNum) throws UnknownHostException
IPNum - IP number you wish to convertUnknownHostException - If unable to convert byte array to IP addresspublic String DecimalToIPv6(BigInteger IPNum) throws UnknownHostException
IPNum - IP number you wish to convertUnknownHostException - If unable to convert byte array to IP addresspublic String CompressIPv6(String IPAddress)
IPAddress - IP Address you wish to compresspublic String ExpandIPv6(String IPAddress)
IPAddress - IP Address you wish to expandpublic List<String> IPv4ToCIDR(String IPFrom, String IPTo) throws UnknownHostException
IPFrom - Starting IP of the rangeIPTo - Ending IP of the rangeUnknownHostException - If unable to convert byte array to IP addresspublic List<String> IPv6ToCIDR(String IPFrom, String IPTo) throws UnknownHostException
IPFrom - Starting IP of the rangeIPTo - Ending IP of the rangeUnknownHostException - If unable to convert byte array to IP addresspublic String[] CIDRToIPv4(String CIDR) throws UnknownHostException
CIDR - CIDR address to convert to rangeUnknownHostException - If unable to convert byte array to IP addresspublic String[] CIDRToIPv6(String CIDR) throws UnknownHostException
CIDR - CIDR address to convert to rangeUnknownHostException - If unable to convert byte array to IP addressCopyright © 2017–2023. All rights reserved.