public abstract class InetAddressUtils extends Object
Abstract InetAddressUtils class.
Modifier and Type | Class and Description |
---|---|
static class |
InetAddressUtils.AddressType |
Modifier and Type | Field and Description |
---|---|
static String |
INVALID_BRIDGE_ADDRESS |
static String |
INVALID_STP_BRIDGE_DESIGNATED_PORT |
static String |
INVALID_STP_BRIDGE_ID |
protected static DecimalFormat |
NO_DIGITS_AFTER_DECIMAL
Always print at least one digit after the decimal point,
and at most three digits after the decimal point.
|
protected static DecimalFormat |
ONE_DIGIT_AFTER_DECIMAL
Print no digits after the decimal point (heh, nor a decimal point).
|
static InetAddress |
ONE_TWENTY_SEVEN |
static InetAddress |
TWO_FIFTY_FIVES |
static InetAddress |
UNPINGABLE_ADDRESS |
static InetAddress |
UNPINGABLE_ADDRESS_IPV6 |
static InetAddress |
ZEROS |
Constructor and Description |
---|
InetAddressUtils() |
Modifier and Type | Method and Description |
---|---|
static InetAddress |
addr(String ipAddrString) |
static InetAddress |
convertBigIntegerIntoInetAddress(BigInteger i) |
static InetAddress |
convertCidrToInetAddressV4(int cidr) |
static InetAddress |
convertCidrToInetAddressV6(int cidr) |
static byte[] |
decr(byte[] address) |
static String |
decr(String address) |
static BigInteger |
difference(InetAddress addr1,
InetAddress addr2) |
static BigInteger |
difference(String addr1,
String addr2) |
static String |
getBridgeAddressFromStpBridgeId(String bridgeId) |
static int |
getBridgeDesignatedPortNumber(String stpPortDesignatedPort) |
static String |
getHumanReadableIfSpeed(long ifSpeed)
Method used to convert an integer bits-per-second value to a more
readable vale using commonly recognized abbreviation for network
interface speeds.
|
static InetAddress |
getInetAddress(byte[] ipAddrOctets) |
static InetAddress |
getInetAddress(int[] octets,
int offset,
int length) |
static InetAddress |
getInetAddress(String dottedNotation)
getInetAddress
|
static InetAddress |
getIpAddressByHexString(String ipaddrhexstrng) |
static InetAddress |
getLocalHostAddress() |
static String |
getLocalHostAddressAsString() |
static String |
getLocalHostName() |
static Optional<InetAddress> |
getLocalLoopbackAddress() |
static InetAddress |
getLowestInetAddress(List<InetAddress> addresses)
Given a list of IP addresses, return the lowest as determined by the
numeric representation and not the alphanumeric string.
|
static InetAddress |
getNetwork(InetAddress ipaddress,
InetAddress netmask) |
static byte[] |
incr(byte[] address) |
static String |
incr(String address) |
static boolean |
inSameNetwork(InetAddress addr1,
InetAddress addr2,
InetAddress mask) |
static boolean |
inSameScope(InetAddress addr1,
InetAddress addr2) |
static boolean |
isInetAddressInRange(byte[] addr,
byte[] begin,
byte[] end) |
static boolean |
isInetAddressInRange(byte[] laddr,
String beginString,
String endString) |
static boolean |
isInetAddressInRange(String ipAddr,
byte[] begin,
byte[] end) |
static boolean |
isInetAddressInRange(String addrString,
String beginString,
String endString) |
static boolean |
isValidBridgeAddress(String bridgeAddress) |
static boolean |
isValidStpBridgeId(String bridgeId) |
static boolean |
isValidStpDesignatedPort(String bridgeDesignatedPort) |
static String |
macAddressBytesToString(byte[] macAddress) |
static byte[] |
macAddressStringToBytes(String macAddress) |
static String |
normalize(String ipAddrString)
This function is used to ensure that an IP address string is in fully-qualified
format without any "::" segments for an IPv6 address.
|
static String |
normalizeMacAddress(String macAddress) |
static String |
str(InetAddress addr) |
static BigInteger |
toInteger(InetAddress ipAddress) |
static byte[] |
toIpAddrBytes(String dottedNotation)
toIpAddrBytes
|
static String |
toIpAddrString(byte[] addr)
toIpAddrString
|
static String |
toIpAddrString(InetAddress addr)
toIpAddrString
|
static String |
toOid(InetAddress addr) |
static String |
toUrlIpAddress(InetAddress addr)
Method that wraps IPv6 addresses in square brackets so that they are parsed
correctly by the
JMXServiceURL class. |
protected static final DecimalFormat NO_DIGITS_AFTER_DECIMAL
protected static final DecimalFormat ONE_DIGIT_AFTER_DECIMAL
public static final String INVALID_BRIDGE_ADDRESS
public static final String INVALID_STP_BRIDGE_ID
public static final String INVALID_STP_BRIDGE_DESIGNATED_PORT
public static final InetAddress UNPINGABLE_ADDRESS
public static final InetAddress UNPINGABLE_ADDRESS_IPV6
public static final InetAddress ZEROS
public static final InetAddress TWO_FIFTY_FIVES
public static final InetAddress ONE_TWENTY_SEVEN
public static InetAddress getLocalHostAddress()
public static String getLocalHostAddressAsString()
public static Optional<InetAddress> getLocalLoopbackAddress()
public static String getLocalHostName()
public static String incr(String address) throws UnknownHostException
UnknownHostException
public static byte[] incr(byte[] address) throws UnknownHostException
UnknownHostException
public static String decr(String address) throws UnknownHostException
UnknownHostException
public static byte[] decr(byte[] address) throws UnknownHostException
UnknownHostException
public static InetAddress getInetAddress(int[] octets, int offset, int length)
public static InetAddress getInetAddress(byte[] ipAddrOctets)
public static InetAddress getInetAddress(String dottedNotation)
getInetAddress
dottedNotation
- a String
object.InetAddress
object.public static byte[] toIpAddrBytes(String dottedNotation)
toIpAddrBytes
dottedNotation
- a String
object.public static String toIpAddrString(InetAddress addr)
toIpAddrString
addr
- IP addressString
object.public static String toIpAddrString(byte[] addr)
toIpAddrString
addr
- an array of byte.String
object.public static String toUrlIpAddress(InetAddress addr)
JMXServiceURL
class.public static InetAddress getLowestInetAddress(List<InetAddress> addresses)
addresses
- a List
object.InetAddress
object.public static BigInteger difference(String addr1, String addr2)
public static BigInteger difference(InetAddress addr1, InetAddress addr2)
public static boolean isInetAddressInRange(byte[] laddr, String beginString, String endString)
public static boolean isInetAddressInRange(String addrString, String beginString, String endString)
public static boolean inSameScope(InetAddress addr1, InetAddress addr2)
public static InetAddress getNetwork(InetAddress ipaddress, InetAddress netmask)
public static boolean inSameNetwork(InetAddress addr1, InetAddress addr2, InetAddress mask)
public static boolean isInetAddressInRange(byte[] addr, byte[] begin, byte[] end)
public static boolean isInetAddressInRange(String ipAddr, byte[] begin, byte[] end)
public static InetAddress convertCidrToInetAddressV4(int cidr)
public static InetAddress convertCidrToInetAddressV6(int cidr)
public static InetAddress convertBigIntegerIntoInetAddress(BigInteger i) throws UnknownHostException
UnknownHostException
public static InetAddress addr(String ipAddrString)
public static String normalize(String ipAddrString)
public static String str(InetAddress addr)
public static BigInteger toInteger(InetAddress ipAddress)
public static String toOid(InetAddress addr)
public static byte[] macAddressStringToBytes(String macAddress)
public static String macAddressBytesToString(byte[] macAddress)
public static boolean isValidStpDesignatedPort(String bridgeDesignatedPort)
public static int getBridgeDesignatedPortNumber(String stpPortDesignatedPort)
public static boolean isValidBridgeAddress(String bridgeAddress)
public static boolean isValidStpBridgeId(String bridgeId)
public static String getBridgeAddressFromStpBridgeId(String bridgeId)
public static InetAddress getIpAddressByHexString(String ipaddrhexstrng)
public static String getHumanReadableIfSpeed(long ifSpeed)
ifSpeed
- The bits-per-second value to be converted into a string
descriptionCopyright © 2021. All rights reserved.