List of usage examples for java.util UUID UUID
public UUID(long mostSigBits, long leastSigBits)
From source file:org.linguafranca.pwdb.kdbx.Helpers.java
public static UUID uuidFromBase64(String base64) { // round the houses for Android byte[] buffer = Base64.decodeBase64(base64.getBytes()); ByteBuffer b = ByteBuffer.wrap(buffer); return new UUID(b.getLong(), b.getLong(8)); }
From source file:info.archinnov.achilles.test.builders.TweetTestBuilder.java
public TweetTestBuilder randomId() { this.id = new UUID(RandomUtils.nextLong(), RandomUtils.nextLong()); return this; }
From source file:org.chromium.media.MediaDrmBridge.java
private static UUID getUUIDFromBytes(byte[] data) { if (data.length != 16) { return null; }/*from w w w. j a v a2 s. c o m*/ long mostSigBits = 0; long leastSigBits = 0; for (int i = 0; i < 8; i++) { mostSigBits = (mostSigBits << 8) | (data[i] & 0xff); } for (int i = 8; i < 16; i++) { leastSigBits = (leastSigBits << 8) | (data[i] & 0xff); } return new UUID(mostSigBits, leastSigBits); }
From source file:net.geertvos.theater.core.util.UUIDGen.java
/** * Creates a type 1 UUID (time-based UUID) that substitutes a hash of * an IP address in place of the MAC (unavailable to Java). * /* w ww .j a v a 2 s.co m*/ * @param addr the host address to use * @return a UUID instance */ public static UUID makeType1UUIDFromHost(InetAddress addr) { return new UUID(instance.createTimeSafe(), instance.getClockSeqAndNode(addr)); }
From source file:com.easemob.dataexport.utils.ConversionUtils.java
/** * @param uuid/*from w ww .jav a 2 s. c om*/ * @param offset * @return */ public static UUID uuid(byte[] uuid, int offset) { ByteBuffer bb = ByteBuffer.wrap(uuid, offset, 16); return new UUID(bb.getLong(), bb.getLong()); }
From source file:org.dashbuilder.dataset.UUIDGeneratorImpl.java
public String uuidFromBase64(String str) { byte[] bytes = Base64.decodeBase64(str); ByteBuffer bb = ByteBuffer.wrap(bytes); UUID uuid = new UUID(bb.getLong(), bb.getLong()); return uuid.toString(); }
From source file:net.geertvos.theater.core.util.UUIDGen.java
/** creates a type 1 uuid from raw bytes. */ public static UUID getUUID(ByteBuffer raw) { return new UUID(raw.getLong(raw.position()), raw.getLong(raw.position() + 8)); }
From source file:org.dashbuilder.dataset.backend.BackendUUIDGenerator.java
public String uuidFromBase64(String str) { Base64 base64 = new Base64(); byte[] bytes = base64.decodeBase64(str); ByteBuffer bb = ByteBuffer.wrap(bytes); UUID uuid = new UUID(bb.getLong(), bb.getLong()); return uuid.toString(); }
From source file:com.easemob.dataexport.utils.ConversionUtils.java
public static UUID uuid(ByteBuffer bb) { if (bb == null) { return null; }/*w w w . j av a 2 s . c o m*/ if (bb.remaining() < 16) { return null; } bb = bb.slice(); return new UUID(bb.getLong(), bb.getLong()); }
From source file:net.geertvos.theater.core.util.UUIDGen.java
/** reads a uuid from an input stream. */ public static UUID read(DataInput dis) throws IOException { return new UUID(dis.readLong(), dis.readLong()); }