Package ru.bitel.common.inet
Class IpNet
java.lang.Object
ru.bitel.common.inet.IpNet
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
IpResourceNet
public class IpNet
extends java.lang.Object
implements java.io.Serializable
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object obj)
byte[]
getBroadcast()
static byte[]
getBroadcast(byte[] subnet, int mask)
192.168.1.255byte[]
getHostMax()
byte[]
getHostMin()
int
getMask()
static int
getMask(byte[] addressFrom, byte[] addressTo)
byte[]
getMaxIp()
byte[]
getNetmask()
static byte[]
getNetmask(int size, int mask)
255.255.255.0byte[]
getNetmaskWildcard()
static byte[]
getNetmaskWildcard(int size, int mask)
0.0.0.255byte[]
getSubnet()
int
hashCode()
boolean
inNet(byte[] address)
static boolean
inNet(byte[] address, byte[] subnet, int mask)
static int
maskToInt(byte[] mask)
static IpNet
newInstance(byte[] addressFrom, byte[] addressTo)
Создание новой подсети из правильного диапазона.void
setMask(int mask)
void
setSubnet(byte[] subnet)
static java.lang.String
toRFCString(byte[] addressFrom, byte[] addressTo)
Возвращает строковое представление подсети.java.lang.String
toString()
static java.lang.String
toString(byte[] addressFrom, byte[] addressTo)
Возвращает строковое представление подсети.static java.lang.String
toString(byte[] subnet, int mask)
Возвращает строковое представление подсети.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Field Details
-
subnet
protected byte[] subnet -
mask
protected int mask
-
-
Constructor Details
-
IpNet
public IpNet() -
IpNet
public IpNet(byte[] subnet, int mask)
-
-
Method Details
-
getSubnet
public byte[] getSubnet() -
setSubnet
public void setSubnet(byte[] subnet) -
getMask
public int getMask() -
setMask
public void setMask(int mask) -
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
toString
public static java.lang.String toString(byte[] subnet, int mask)Возвращает строковое представление подсети.- Parameters:
subnet
-mask
-- Returns:
-
toString
public static java.lang.String toString(byte[] addressFrom, byte[] addressTo)Возвращает строковое представление подсети.- Parameters:
subnet
-mask
-- Returns:
-
toRFCString
public static java.lang.String toRFCString(byte[] addressFrom, byte[] addressTo)Возвращает строковое представление подсети.- Parameters:
subnet
-mask
-- Returns:
-
maskToInt
public static int maskToInt(byte[] mask) -
getHostMin
public byte[] getHostMin() -
getHostMax
public byte[] getHostMax() -
getBroadcast
public byte[] getBroadcast() -
getNetmaskWildcard
public byte[] getNetmaskWildcard() -
getNetmask
public byte[] getNetmask() -
getMaxIp
public byte[] getMaxIp() -
getMask
public static int getMask(byte[] addressFrom, byte[] addressTo) -
newInstance
Создание новой подсети из правильного диапазона.- Parameters:
addressFrom
-addressTo
-- Returns:
-
inNet
public boolean inNet(byte[] address) -
inNet
public static boolean inNet(byte[] address, byte[] subnet, int mask) -
getNetmaskWildcard
public static byte[] getNetmaskWildcard(int size, int mask)0.0.0.255- Parameters:
size
-mask
-- Returns:
-
getNetmask
public static byte[] getNetmask(int size, int mask)255.255.255.0- Parameters:
size
-mask
-- Returns:
-
getBroadcast
public static byte[] getBroadcast(byte[] subnet, int mask)192.168.1.255- Parameters:
subnet
-mask
-- Returns:
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equals
in classjava.lang.Object
-