Java Code Examples for java.util.UUID.version()

The following are Jave code examples for showing how to use version() of the java.util.UUID class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: burp-uuid   File: UuidIssue.java   View Source Code Vote up 5 votes
public UuidIssue(IHttpRequestResponse baseRequestResponse,
		URL url, UUID uuid) throws IllegalArgumentException {
	httpMessages = new IHttpRequestResponse[] { baseRequestResponse };
	this.url = url;
	this.uuid = uuid;
	isV1or2 = uuid.version() < 3;
}
 
Example 2
Project: iotplatform   File: UUIDConverter.java   View Source Code Vote up 5 votes
public static String fromTimeUUID(UUID src) {
  if (src.version() != 1) {
    throw new IllegalArgumentException("Not a time UUID!");
  }
  String str = src.toString();
  return str.substring(15, 18) + str.substring(9, 13) + str.substring(0, 8) + str.substring(19, 23)
      + str.substring(24);
}
 
Example 3
Project: sstable-adaptor   File: UUIDGen.java   View Source Code Vote up 4 votes
/**
 * Returns a milliseconds-since-epoch value for a type-1 UUID.
 *
 * @param uuid a type-1 (time-based) UUID
 * @return the number of milliseconds since the unix epoch
 * @throws IllegalArgumentException if the UUID is not version 1
 */
public static long getAdjustedTimestamp(UUID uuid)
{
    if (uuid.version() != 1)
        throw new IllegalArgumentException("incompatible with uuid version: "+uuid.version());
    return (uuid.timestamp() / 10000) + START_EPOCH;
}