Serializable
, Comparable<IpAddress>
public enum IpAddress extends Enum<IpAddress>
Modifier and Type | Method | Description |
---|---|---|
static int[] |
fromAnyCidrNotation(String aCidrNotation) |
Creates an IP-Address as of an integer array for the first of the
enumeration elements being able to successfully parse the provided
String in CIDR notation. |
int[] |
fromCidrNotation(String aCidrNotation) |
Creates an IP-Address as of an integer array for the current enumeration
from the provided
String in CIDR notation. |
int[] |
getBroadcast() |
The byte representation of the "broadcast" address (if the protocol
supports a broadcast).
|
char |
getCidrDelimiter() |
The delimiter used by the CIDR notation.
|
String |
getCidrLocalhost() |
Returns the CIDR notation of the localhost IP-Address.
|
String |
getCidrUnspecified() |
Returns the CIDR notation of the unspecified IP-Address.
|
int |
getLength() |
Returns the length in bytes of the IP-Address.
|
int[] |
getLocalhost() |
The byte representation of the "localhost".
|
String |
getLocalhostAlias() |
The commonly used alias for the "localhost".
|
int[] |
getUnspecified() |
The byte representation of the "unspecified".
|
static boolean |
isAnyCidrNotation(String aCidrNotation) |
Determines whether the given
String represents a valid
IP-Address. |
static boolean |
isBroadcast(int[] aIpAddress) |
Determines whether the given IP-Address is the broadcast address.
|
boolean |
isCidrNotation(String aCidrNotation) |
Determines whether the given
String represents a valid CIDR
notation. |
static boolean |
isLocalhost(int[] aIpAddress) |
Determines whether the given IP-Address represents the IP-Address of the
"localhost" as of
getLocalhost() . |
static boolean |
isLoopback(int[] aIpAddress) |
Determines whether the given IP-Address is in the scope of the the
loopback interfaces.
|
String |
toCidrNotation(int[] theIpAddress) |
|
static int[] |
toHostIpAddress() |
Tries to determine a no-localhost IP-Address for this machine.
|
static String |
toString(int[] aIpAddress) |
Creates a
String as of the CIDR notation from the provided
IP-Address bytes. |
static Set<String> |
toVisibleIpAddresses() |
Tries to determine the known IP-Addresses from the accessible network
segment.
|
static IpAddress |
valueOf(String name) |
Returns the enum constant of this type with the specified name.
|
static IpAddress[] |
values() |
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final IpAddress IPV4
public static final IpAddress IPV6
public static IpAddress[] values()
for (IpAddress c : IpAddress.values()) System.out.println(c);
public static IpAddress valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic int getLength()
public int[] getUnspecified()
public String getCidrUnspecified()
public int[] getLocalhost()
public int[] getBroadcast()
public String getCidrLocalhost()
public String getLocalhostAlias()
public char getCidrDelimiter()
public String toCidrNotation(int[] theIpAddress)
public int[] fromCidrNotation(String aCidrNotation)
String
in CIDR notation.aCidrNotation
- The String in CIDR notation to be parsed.IllegalArgumentException
- Thrown in case the provided
String
is not of any known CIDR notation.public static String toString(int[] aIpAddress)
String
as of the CIDR notation from the provided
IP-Address bytes. See also
"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation".public static boolean isLocalhost(int[] aIpAddress)
getLocalhost()
.aIpAddress
- The IP-Address to be tested.public static boolean isLoopback(int[] aIpAddress)
aIpAddress
- The IP-Address to be tested.public static boolean isBroadcast(int[] aIpAddress)
aIpAddress
- The IP-Address to be tested.public static int[] fromAnyCidrNotation(String aCidrNotation)
String
in CIDR notation.aCidrNotation
- The String in CIDR notation to be parsed.IllegalArgumentException
- Thrown in case the provided
String
is not of any known CIDR notation.public static int[] toHostIpAddress() throws IOException
getLocalhost()
).getLocalhost()
) may be returned.IOException
- Thrown to indicate that the IP address of a host
could not be determined.public static boolean isAnyCidrNotation(String aCidrNotation)
String
represents a valid
IP-Address.aCidrNotation
- The Text in CIDR notation to be tested.public boolean isCidrNotation(String aCidrNotation)
String
represents a valid CIDR
notation.aCidrNotation
- The Text in CIDR notation to be tested.public static Set<String> toVisibleIpAddresses()
Copyright © 2018. All rights reserved.