|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.hccp.net.InetAddressColorFactory
A simple hack for converting IPv4 addresses into RGB+alpha colors,
as well as resolving RGB+alpha colors into IPv4 addresses.
In the case of address -> color, it simply takes each of the octets and assigns it's value to a particular
channel. For instance, 64.81.140.31 would resolve to a color similar to this.* In the case of color -> address, the color's red, green, blue, and alpha channel values will become the four octet values. For example, java.awt.Color.RED would resolve to the IP address 255.0.0.255.**
* This is not an exact representation, due to the fact that we cannot
render the alpha channel transparency effected by the last octet (the "31").
** One can see that the resolution of color -> address may not
necessarily produce a real or "pingable" IP address.
| Constructor Summary | |
InetAddressColorFactory()
|
|
| Method Summary | |
static java.awt.Color |
getColor(java.net.InetAddress address)
This simply takes each of the octets and assigns it's value to a particular channel. |
static java.awt.Color |
getColor(java.lang.String address)
Takes a string representation ("xxx.xxx.xxx.xxx") and for each of the octets, assigns it's value to a particular channel. |
static java.net.InetAddress |
getInetAddress(java.awt.Color color)
Converts a java.awt.Color object into a corresponding java.net.InetAddress. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public InetAddressColorFactory()
| Method Detail |
public static java.awt.Color getColor(java.lang.String address)
public static java.awt.Color getColor(java.net.InetAddress address)
public static java.net.InetAddress getInetAddress(java.awt.Color color)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||