|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.safehaus.uuid.EthernetAddress
public class EthernetAddress
EthernetAddress encapsulates the 6-byte Mac address defined in IEEE 802.1 standard.
| Constructor Summary | |
|---|---|
EthernetAddress(byte[] addr)
Binary constructor that constructs an instance given the 6 byte (48-bit) address. |
|
EthernetAddress(long addr)
Another binary constructor; constructs an instance from the given long argument; the lowest 6 bytes contain the address. |
|
EthernetAddress(String addrStr)
String constructor; given a 'standard' ethernet MAC address string (like '00:C0:F0:3D:5B:7C'), constructs an EthernetAddress instance. |
|
| Method Summary | |
|---|---|
byte[] |
asByteArray()
Returns 6 byte byte array that contains the binary representation of this ethernet address; byte 0 is the most significant byte (and so forth) |
Object |
clone()
Default cloning behaviour (bitwise copy) is just fine... |
int |
compareTo(Object o)
Method that compares this EthernetAddress to one passed in as argument. |
boolean |
equals(Object o)
|
static void |
main(String[] args)
|
byte[] |
toByteArray()
Synonym to 'asByteArray()' |
void |
toByteArray(byte[] array)
|
void |
toByteArray(byte[] array,
int pos)
|
long |
toLong()
|
String |
toString()
Returns the canonical string representation of this ethernet address. |
static EthernetAddress |
valueOf(byte[] addr)
Constructs a new EthernetAddress given the byte array that contains binary representation of the address. |
static EthernetAddress |
valueOf(int[] addr)
Constructs a new EthernetAddress given the byte array that contains binary representation of the address. |
static EthernetAddress |
valueOf(long addr)
Constructs a new EthernetAddress given the long int value (64-bit) representation of the ethernet address (of which 48 LSB contain the definition) Note that calling this method returns the same result as would using the matching constructor. |
static EthernetAddress |
valueOf(String addrStr)
Constructs a new EthernetAddress given a string representation of the ethernet address. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public EthernetAddress(String addrStr)
throws NumberFormatException
addrStr - String representation of the ethernet address
NumberFormatException
public EthernetAddress(byte[] addr)
throws NumberFormatException
NumberFormatExceptionpublic EthernetAddress(long addr)
addr - long that contains the MAC address in 6 least significant
bytes.| Method Detail |
|---|
public Object clone()
clone in class Objectpublic boolean equals(Object o)
equals in class Objectpublic int compareTo(Object o)
compareTo in interface Comparablepublic String toString()
toString in class Objectpublic byte[] asByteArray()
public byte[] toByteArray()
public void toByteArray(byte[] array)
public void toByteArray(byte[] array,
int pos)
public long toLong()
public static EthernetAddress valueOf(byte[] addr)
throws NumberFormatException
addr - Binary representation of the ethernet address
NumberFormatException - if addr is invalid (less or more than
6 bytes in array)
public static EthernetAddress valueOf(int[] addr)
throws NumberFormatException
addr - Binary representation of the ethernet address
NumberFormatException - if addr is invalid (less or more than
6 ints in array)
public static EthernetAddress valueOf(String addrStr)
throws NumberFormatException
addrStr - String representation of the ethernet address
NumberFormatException - if addr representation is invalidpublic static EthernetAddress valueOf(long addr)
addr - Long int representation of the ethernet addresspublic static void main(String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||