public final class UUID extends Object implements Comparable<UUID>
Modifier and Type | Field and Description |
---|---|
static int |
KEYSIZE
Native size of the UUID
|
Constructor and Description |
---|
UUID()
Constructor that generates a new UUID using the current process id, MAC address, and timestamp
|
UUID(boolean on128bits)
Create a UUID immediately compatible with a standard UUID implementation
|
UUID(byte[] bytes)
Constructor that takes a byte array as this UUID's content
|
UUID(int id)
Constructor that generates a new UUID using the current process id, MAC address, and timestamp
|
UUID(long mostSigBits,
long leastSigBits)
Create a UUID immediately compatible with a standard UUID implementation
|
UUID(String idsource)
Build from String key
|
UUID(UUID uuid)
Create a UUID immediately compatible with a standard UUID implementation
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(UUID arg0) |
boolean |
equals(Object o) |
byte[] |
getBytes()
copy the uuid of this UUID, so that it can't be changed, and return it
|
int |
getCounter() |
int |
getId() |
UUID |
getJavaUuid() |
long |
getLeastSignificantBits() |
byte[] |
getMacFragment()
extract MAC address fragment from raw UUID bytes, setting missing values to 0,
from the active MAC address when the UUID was generated
|
long |
getMostSignificantBits() |
int |
getProcessId()
extract process id from raw UUID bytes and return as int
|
static byte[] |
getRandom(int length) |
long |
getTimestamp()
extract timestamp from raw UUID bytes and return as int
|
int |
getVersion()
extract version field as a hex char from raw UUID bytes
|
int |
hashCode() |
byte[] |
javaUuidGetBytes()
copy the uuid of this UUID, so that it can't be changed, and return it
|
static int |
jvmProcessId() |
static byte[] |
macAddress() |
static void |
main(String[] args)
Simply return a new UUID.
|
protected UUID |
setBytes(byte[] bytes)
Internal function
|
static void |
setMAC(byte[] mac)
Up to the 6 first bytes will be used.
|
String |
toBase64() |
String |
toHex() |
String |
toString() |
public static final int KEYSIZE
public UUID()
public UUID(int id)
id
- the id of the subset of UUID from which it belongs to (default being 0, else between 1 and 255)public UUID(boolean on128bits)
on128bits
- True for 128 bits limitation (16 Bytes instead of 20 Bytes)public UUID(long mostSigBits, long leastSigBits)
mostSigBits
- leastSigBits
- public UUID(UUID uuid)
uuid
- public UUID(byte[] bytes) throws RuntimeException
bytes
- UUID contentRuntimeException
public UUID(String idsource) throws RuntimeException
idsource
- RuntimeException
public static void setMAC(byte[] mac)
mac
- the MAC address in byte format (up to the 6 first bytes will be used)protected UUID setBytes(byte[] bytes) throws RuntimeException
bytes
- RuntimeException
public final String toBase64()
public final String toHex()
public byte[] getBytes()
public final int getVersion()
public final int getId()
public final int getProcessId()
public final int getCounter()
public final long getTimestamp()
public final byte[] getMacFragment()
public long getLeastSignificantBits()
public long getMostSignificantBits()
public UUID getJavaUuid()
public byte[] javaUuidGetBytes()
public static final byte[] getRandom(int length)
length
- public static byte[] macAddress()
public static int jvmProcessId()
public int compareTo(UUID arg0)
compareTo
in interface Comparable<UUID>
public static void main(String[] args)
args
- Copyright © 2009–2019 Waarp. All rights reserved.