Package marauroa.server.net.validator
Class InetAddressMask
java.lang.Object
marauroa.server.net.validator.InetAddressMask
This class is a mask that determines if a IPv4 address match with the mask.
It works only for IPv4 addresses
-
Constructor Summary
ConstructorsConstructorDescriptionInetAddressMask(byte[] address, byte[] mask)creates a new InetAddressMask object.InetAddressMask(String address, String mask)creates a new InetAddressMask object. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()booleanmatches(InetAddress anotherAddress)checks whether the provided InetAddress object is within the range specified in this object.static byte[]string2bytes(String ipv4Address)converts string in form aaa.bbb.ccc.ddd into byte array[]{aaa,bbb,ccc,ddd}toString()
-
Constructor Details
-
InetAddressMask
creates a new InetAddressMask object.- Parameters:
address- address in form aaa.bbb.ccc.dddmask- network mask in form aaa.bbb.ccc.ddd
-
InetAddressMask
public InetAddressMask(byte[] address, byte[] mask)creates a new InetAddressMask object.- Parameters:
address- addressmask- network mask
-
-
Method Details
-
matches
checks whether the provided InetAddress object is within the range specified in this object.- Parameters:
anotherAddress- address to check- Returns:
- true if it is within this range, false otherwise
-
hashCode
public int hashCode() -
equals
-
toString
-
string2bytes
converts string in form aaa.bbb.ccc.ddd into byte array[]{aaa,bbb,ccc,ddd}- Parameters:
ipv4Address- address string- Returns:
- byte array
-