public final class EtherAddress extends Object implements Serializable
EtherAddress describes an ethernet address, aka MAC address.| Modifier and Type | Field and Description |
|---|---|
static int |
BIT_MULTICAST
Multicast bit in the first octet.
|
static EtherAddress |
BROADCAST
A
EtherAddress instance which represents a broadcast address. |
static long |
MASK_MULTICAST
A mask value that indicates the multicast bit in the first octet.
|
static int |
SIZE
The number of octets in an ethernet address.
|
| Constructor and Description |
|---|
EtherAddress(byte[] bytes)
Construct a new instance.
|
EtherAddress(long addr)
Construct a new instance.
|
EtherAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress mac)
Construct a new instance.
|
EtherAddress(String hex)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
static EtherAddress |
create(byte[] bytes)
Create a new
EtherAddress instance. |
static EtherAddress |
create(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress mac)
Create a new
EtherAddress instance. |
static EtherAddress |
create(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.MacAddressFilter mf)
Create a new
EtherAddress instance. |
static EtherAddress |
create(String hex)
Create a new
EtherAddress instance. |
boolean |
equals(Object o)
Determine whether the given object is identical to this object.
|
long |
getAddress()
Return a long number which represents this ethernet address.
|
byte[] |
getBytes()
Return a byte array which represents this ethernet address.
|
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress |
getMacAddress()
Return a
MacAddress instance which represents this ethernet
address. |
String |
getText()
Return a hex string which represents this ethernet address.
|
int |
hashCode()
Return the hash code of this object.
|
boolean |
isBroadcast()
Determine whether this instance represents a broadcast address or not.
|
static boolean |
isBroadcast(byte[] bytes)
Determine whether the given byte array represents a broadcast address
or not.
|
boolean |
isUnicast()
Determine whether this instance represents an unicast address or not.
|
static boolean |
isUnicast(byte[] bytes)
Determine whether the given byte array represents an unicast address
or not.
|
static byte[] |
toBytes(long addr)
Convert a long number which represents an ethernet address into a byte
array.
|
static byte[] |
toBytes(String hex)
Convert a string representation of an ethernet address into a byte
array.
|
static long |
toLong(byte[] b)
Convert the given byte array that represents an ethernet address into
a long integer number.
|
static long |
toLong(String hex)
Convert a string representation of an ethernet address into a long
integer number.
|
String |
toString()
Return a string representation of this object.
|
public static final int SIZE
public static final int BIT_MULTICAST
public static final long MASK_MULTICAST
public static final EtherAddress BROADCAST
EtherAddress instance which represents a broadcast address.public EtherAddress(long addr)
addr - A long integer value which represents an ethernet address.public EtherAddress(byte[] bytes)
bytes - A byte array which represents an ethernet address.NullPointerException - bytes is null.IllegalArgumentException - The length of bytes is not 6.public EtherAddress(String hex)
hex - A hex string which represents an ethernet address.NullPointerException - hex is null.IllegalArgumentException - The given string is not a string representation of an ethernet
address.public EtherAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress mac)
mac - A MacAddress instance.NullPointerException - mac is null.IllegalArgumentException - The given instance contains an invalid value.public static long toLong(byte[] b)
b - A byte array.NullPointerException - b is null.IllegalArgumentException - The length of b is not 6.public static long toLong(String hex)
hex - A hex string which represents an ethernet address.NullPointerException - hex is null.NumberFormatException - The given string is not a hex string.IllegalArgumentException - The given string is not a string representation of an ethernet
address.public static byte[] toBytes(long addr)
addr - A long integer which represents an byte array.public static byte[] toBytes(String hex)
hex - A hex string which represents an ethernet address.null is returned if null is passed.IllegalArgumentException - The given string is not a string representation of an ethernet
address.public static boolean isBroadcast(byte[] bytes)
bytes - A byte array to be tested.true only if the given byte array represents a
broadcast address.public static boolean isUnicast(byte[] bytes)
bytes - A byte array to be tested.true only if the given byte array represents an
unicast address.public static EtherAddress create(byte[] bytes)
EtherAddress instance.bytes - A byte array which represents an ethernet address.EtherAddress instance if bytes is not
null. null if bytes is null.IllegalArgumentException - The length of bytes is not 6.public static EtherAddress create(String hex)
EtherAddress instance.hex - A hex string which represents an ethernet address.EtherAddress instance if hex is not
null. null if hex is null.IllegalArgumentException - The given string is not a string representation of an ethernet
address.public static EtherAddress create(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress mac)
EtherAddress instance.mac - A MacAddress instance.EtherAddress instance if mac is not
null. null if mac is null.IllegalArgumentException - The given instance contains an invalid value.public static EtherAddress create(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.MacAddressFilter mf)
EtherAddress instance.mf - A MacAddressFilter instance.
Note that MAC address mask is always ignored.EtherAddress instance if a valid MAC address is
configured in mf. Otherwise null.IllegalArgumentException - The given instance contains an invalid value.public long getAddress()
public byte[] getBytes()
public org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress getMacAddress()
MacAddress instance which represents this ethernet
address.MacAddress instance.public String getText()
Note that below description of return value of this method is written for REST API document.
A MAC address is represented by hexadecimal notation with
':' inserted between octets.
(e.g. "11:22:33:aa:bb:cc")
public boolean isBroadcast()
true only if this instance represents a broadcast
address.public boolean isUnicast()
true only if this instance represents an unicast
address.public boolean equals(Object o)
public int hashCode()
Copyright © 2018 OpenDaylight. All rights reserved.