public class IP extends Object implements Comparable<IP>, Serializable
IP
represents an IP v4 address.Constructor and Description |
---|
IP(byte[] address)
Constructs IP by bytes.
|
IP(int a,
int b,
int c,
int d)
Constructs IP by four numbers.
|
IP(long ip)
Constructs IP by a long integer.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(IP ip) |
boolean |
equals(Object obj) |
int |
getA() |
int |
getB() |
int |
getC() |
int |
getD() |
long |
getValue() |
int |
hashCode() |
boolean |
isLocalIP()
Returns
true if the IP is local IP address. |
boolean |
isUseInInteret()
Returns
true if the IP can be used in Internet. |
static boolean |
isValid(String ip) |
static IP |
MAX_IP()
Gets max IP which represents 255.255.255.255].
|
static IP |
MIN_IP()
Gets minimum IP which represents 0.0.0.0.
|
IP |
nextIP()
Gets next IP address.
|
static IP |
parseFromString(String ip)
Creates a IP instance by a string.
|
IP |
preIP()
Gets previous IP address.
|
long |
toLong()
Returns IP as a long integer.
|
String |
toString() |
public IP(int a, int b, int c, int d)
a
- First number of the IP address.b
- Second number of the IP address.c
- Third number of the IP address.d
- Last number of the IP address.public IP(long ip)
ip
- IP as Long integer.public IP(byte[] address)
address
- Bytes of address.public static IP parseFromString(String ip)
ip
- IP as a string. such as "192.168.1.1".Ip
.public static IP MAX_IP()
public static IP MIN_IP()
public int getA()
public int getB()
public int getC()
public int getD()
public IP nextIP()
null
.public IP preIP()
null
.public boolean isLocalIP()
true
if the IP is local IP address.true
if the IP is local IP address.public boolean isUseInInteret()
true
if the IP can be used in Internet.true
if the IP can be used in Internet.public long toLong()
public static boolean isValid(String ip)
public int compareTo(IP ip)
compareTo
in interface Comparable<IP>
public long getValue()
Copyright © 2015. All rights reserved.