Java UUID Create generateUuid(String seed)

Here you can find the source of generateUuid(String seed)

Description

Generates a GUID using a seed.

License

Apache License

Parameter

Parameter Description
seed The seed to use for generating the GUID

Return

A string representation of the GUID

Declaration

public static UUID generateUuid(String seed) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.UnsupportedEncodingException;

import java.util.UUID;

public class Main {
    /**/*w  w  w .  j a  v  a 2  s  .  c  o m*/
     * Generates a GUID using a seed.  This will generate the same GUID usign the same seed.
     * @param seed The seed to use for generating the GUID
     * @return A string representation of the GUID
     */
    public static UUID generateUuid(String seed) {
        try {
            return UUID.nameUUIDFromBytes(seed.getBytes("UTF-8"));
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(String.format("UnsupportedEncodingException: %f", e.getMessage()));
        }
    }
}

Related

  1. generateUUID()
  2. generateUuid(boolean dash)
  3. generateUUID(int numchars)
  4. generateUUID(Object o)
  5. generateUUID(String prefix)
  6. generateUUIDFileName(String fileName)
  7. generateUUIDFrom(String uuidString)
  8. generateUUIDFromString(String uuid)
  9. generateUUIDName(String filename)