public enum IpAddress extends Enum<IpAddress>
Modifier and Type | Method and Description |
---|---|
int[] |
fromCidrNotation(String aCidrNotation) |
static int[] |
fromString(String aCidrNotation)
Creates a
String as of the CIDR notation from the provided
IP-Address bytes. |
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 |
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[] |
toIpAddress()
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 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 String getCidrLocalhost()
public String getLocalhostAlias()
public char getCidrDelimiter()
public String toCidrNotation(int[] theIpAddress)
public int[] fromCidrNotation(String aCidrNotation)
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 int[] fromString(String aCidrNotation)
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".aCidrNotation
- The IP-Address String
for which to generate
a IP-Address.public static int[] toIpAddress() throws IOException
getLocalhost()
).getLocalhost()
) may be returned.IOException
- Thrown to indicate that the IP address of a host
could not be determined.Copyright © 2018. All rights reserved.