public final class UUIDGen extends Object
UUID
.
Starting with version 2, this implementation tries to obtain the MAC address
of the network card. Under Microsoft Windows, the ifconfig
command is used which may pop up a command window in Java Virtual Machines
prior to 1.4 once this class is initialized. The command window is closed
automatically.
The MAC address code has been tested extensively in Microsoft Windows, Linux, Solaris 8, HP-UX 11, but should work in MacOS X and BSDs, too.
If you use JDK 6 or later, the code in InterfaceAddress
will be used.
UUID
Constructor and Description |
---|
UUIDGen() |
Modifier and Type | Method and Description |
---|---|
static long |
createTime(long currentTimeMillis)
Creates a new time field from the given timestamp.
|
static long |
getClockSeqAndNode()
Returns the current clockSeqAndNode value.
|
static String |
getMACAddress()
Returns the MAC address.
|
static long |
newTime()
Generates a new time field.
|
public static long getClockSeqAndNode()
UUID.getClockSeqAndNode()
public static long newTime()
UUID.getTime()
public static long createTime(long currentTimeMillis)
currentTimeMillis
will produce different time fields.currentTimeMillis
- the timestampUUID.getTime()
public static String getMACAddress()
null
Copyright © 2003–2018. All rights reserved.