wol.configuration
Class EthernetAddress

java.lang.Object
  extended bywol.configuration.EthernetAddress
All Implemented Interfaces:
Cloneable, Serializable

public class EthernetAddress
extends Object
implements Serializable, Cloneable

This class represents a ethernet address.

An Ethernet Address ia a six octets (48 bits) number that uniquelly identifies every network interface card (NIC). The first three octects (24 bits) are known as the Organizationally Unique Identifier (OUI) and identifies its manufacturer.

Author:
Steffen Moldaner
See Also:
Serialized Form

Constructor Summary
EthernetAddress(byte[] ethernetAddress)
          Create a EthernetAddress based on the provided bytes.
EthernetAddress(String ethernetAddress)
          Create a EthernetAddress based on the provided address.
 
Method Summary
protected  String byteToHexString(byte b)
           
 Object clone()
           
 boolean equals(Object obj)
           
 int hashCode()
           
protected  byte[] parseEthernetAddress(String ethernetAddress)
          Parses a String representing an ethernet address into an byte array.
 byte[] toBytes()
          Returns the byte representation of this ethernet address.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EthernetAddress

public EthernetAddress(String ethernetAddress)
                throws IllegalEthernetAddressException
Create a EthernetAddress based on the provided address. The address must be 6 hexadecimal values seperated by a colon.

E.g.: 00:50:95:10:95:F5

Parameters:
ethernetAddress - the ethernet address
Throws:
IllegalArgumentException - if the ethernet address could not be parsed
NullPointerException - if the ethernet address is null
IllegalEthernetAddressException

EthernetAddress

public EthernetAddress(byte[] ethernetAddress)
                throws IllegalEthernetAddressException
Create a EthernetAddress based on the provided bytes. The byte array must have a length of 6 representing the 48 bit ethernet address.

Parameters:
ethernetAddress - the bytes. Must have length of 6!
Throws:
IllegalEthernetAddressException - if ethernet address is of illegal length or null
NullPointerException - if the ethernet address is null
Method Detail

parseEthernetAddress

protected byte[] parseEthernetAddress(String ethernetAddress)
                               throws IllegalEthernetAddressException
Parses a String representing an ethernet address into an byte array. The String must be a list of 6 hexadecimal bytes, sepeartet by a colon.

Example: 00:50:95:10:95:F5

Parameters:
ethernetAddress - a String representation of the ethernet address.
Returns:
a byte array containing the byte representation of the ethernet address
Throws:
IllegalEthernetAddressException

toBytes

public byte[] toBytes()
Returns the byte representation of this ethernet address.

Returns:
the bytes

equals

public boolean equals(Object obj)

toString

public String toString()

byteToHexString

protected String byteToHexString(byte b)

hashCode

public int hashCode()

clone

public Object clone()