Package org.netxms.base
Class MacAddress
java.lang.Object
org.netxms.base.MacAddress
MAC address representation
- 
Constructor SummaryConstructorsConstructorDescriptionCreate MAC address with value of 00:00:00:00:00:00MacAddress(byte[] src) Create MAC address object from byte arrayMacAddress(byte[] src, int maxLength) Create MAC address object from byte array.
- 
Method SummaryModifier and TypeMethodDescriptionintcompareTo(MacAddress dst) Compare this MAC address to another MAC address.booleanbyte[]getValue()inthashCode()booleanisNull()Check if MAC address is all zeroesstatic MacAddressparseMacAddress(String str) Parse MAC address string representation.static MacAddressparseMacAddress(String str, boolean fullMac) Parse MAC address string representation.toString()
- 
Constructor Details- 
MacAddresspublic MacAddress()Create MAC address with value of 00:00:00:00:00:00
- 
MacAddresspublic MacAddress(byte[] src) Create MAC address object from byte array- Parameters:
- src- byte array containing MAC address value
 
- 
MacAddresspublic MacAddress(byte[] src, int maxLength) Create MAC address object from byte array. Any bytes beyondmaxLengthwill be droppped.- Parameters:
- src- byte array containing MAC address value
- maxLength- maximum possible MAC address length.
 
 
- 
- 
Method Details- 
isNullpublic boolean isNull()Check if MAC address is all zeroes- Returns:
- true if MAC address is all zeroes
 
- 
toString
- 
equals
- 
hashCodepublic int hashCode()
- 
parseMacAddressParse MAC address string representation. Supported representations are 6 groups of two hex digits, separated by spaces, minuses, or colons; or 4 groups of three hex digits separated by dots; or 12 non-separated digits; or 16 non-separated hex digits. Examples of valid MAC address strings: 00:10:FA:23:11:7A 01 02 fa c4 10 dc 00-90-0b-11-01-29 009.00b.110.129 0203fcd456c1 0203FCD465C1DF56- Parameters:
- str- MAC address string
- Returns:
- MAC address object
- Throws:
- MacAddressFormatException- if MAC address sting is invalid
 
- 
parseMacAddresspublic static MacAddress parseMacAddress(String str, boolean fullMac) throws MacAddressFormatException Parse MAC address string representation. Supported representations are 6 groups of two hex digits, separated by spaces, minuses, or colons; or 4 groups of three hex digits separated by dots; or 12 non-separated digits; or 16 non-separated hex digits. Examples of valid MAC address strings: 00:10:FA:23:11:7A 01 02 fa c4 10 dc 00-90-0b-11-01-29 009.00b.110.129 0203fcd456c1 0203FCD465C1DF56 For partial MAC match at least two pairs is required or odd number of triples- Parameters:
- str- MAC address string
- fullMac- if should match full mac address
- Returns:
- MAC address object
- Throws:
- MacAddressFormatException- if MAC address sting is invalid
 
- 
getValuepublic byte[] getValue()- Returns:
- the value
 
- 
compareToCompare this MAC address to another MAC address.- Parameters:
- dst- another @see MacAddress to be compared with.
- Returns:
- 0 if two MAC addresses are equal, negative if this MAC address is "lower", and positive if "higher"
 
 
-