public class MACAddress
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private byte[] |
address |
static int |
MAC_ADDRESS_LENGTH |
Constructor and Description |
---|
MACAddress(byte[] address) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
boolean |
isBroadcast()
Returns
true if the MAC address is the broadcast address. |
boolean |
isMulticast()
Returns
true if the MAC address is the multicast address. |
int |
length()
Returns the length of the
MACAddress . |
byte[] |
toBytes()
Returns the value of the
MACAddress as a byte array. |
long |
toLong()
Returns the value of the
MACAddress as a long . |
java.lang.String |
toString() |
static MACAddress |
valueOf(byte[] address)
Returns a MAC address instance representing the specified
byte array. |
static MACAddress |
valueOf(long address)
Returns a MAC address instance representing the specified
long value. |
static MACAddress |
valueOf(java.lang.String address)
Returns a MAC address instance representing the value of the specified
String . |
public static final int MAC_ADDRESS_LENGTH
private byte[] address
public static MACAddress valueOf(java.lang.String address)
String
.address
- the String representation of the MAC Address to be parsed.String
.java.lang.IllegalArgumentException
- if the string cannot be parsed as a MAC address.public static MACAddress valueOf(byte[] address)
byte
array.address
- the byte array to be parsed.byte
array.java.lang.IllegalArgumentException
- if the byte array cannot be parsed as a MAC address.public static MACAddress valueOf(long address)
long
value.
The lower 48 bits of the long value are used to parse as a MAC address.address
- the long value to be parsed. The lower 48 bits are used for a MAC address.long
value.java.lang.IllegalArgumentException
- if the long value cannot be parsed as a MAC address.public int length()
MACAddress
.MACAddress
.public byte[] toBytes()
MACAddress
as a byte
array.byte
array.public long toLong()
MACAddress
as a long
.long
.public boolean isBroadcast()
true
if the MAC address is the broadcast address.true
if the MAC address is the broadcast address.public boolean isMulticast()
true
if the MAC address is the multicast address.true
if the MAC address is the multicast address.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object