public static UUID uuid(byte[] bytes, int offset) { _checkUUIDByteArray(bytes, offset); return new UUID(gatherLong(bytes, offset), gatherLong(bytes, offset+8)); }
/** * Factory method for constructing {@link java.util.UUID} instance from given * 16 bytes. * NOTE: since absolutely no validation is done for contents, this method should * usually not be used, unless contents are known to be valid. */ public static UUID uuid(byte[] bytes) { _checkUUIDByteArray(bytes, 0); long l1 = gatherLong(bytes, 0); long l2 = gatherLong(bytes, 8); return new UUID(l1, l2); }
/** * @param addr Hardware address (802.1) to use for generating * spatially unique part of UUID. If system has more than one NIC, */ public TimeBasedGenerator(EthernetAddress ethAddr, UUIDTimer timer) { byte[] uuidBytes = new byte[16]; if (ethAddr == null) { ethAddr = EthernetAddress.constructMulticastAddress(); } // initialize baseline with MAC address info _ethernetAddress = ethAddr; _ethernetAddress.toByteArray(uuidBytes, 10); // and add clock sequence int clockSeq = timer.getClockSequence(); uuidBytes[UUIDUtil.BYTE_OFFSET_CLOCK_SEQUENCE] = (byte) clockSeq; uuidBytes[UUIDUtil.BYTE_OFFSET_CLOCK_SEQUENCE+1] = (byte) (clockSeq >> 8); long l2 = UUIDUtil.gatherLong(uuidBytes, 8); _uuidL2 = UUIDUtil.initUUIDSecondLong(l2); _timer = timer; }
/** * Factory method for constructing {@link java.util.UUID} instance from given * 16 bytes. * NOTE: since absolutely no validation is done for contents, this method should * only be used if contents are known to be valid. */ public static UUID uuid(byte[] bytes) { _checkUUIDByteArray(bytes, 0); long l1 = gatherLong(bytes, 0); long l2 = gatherLong(bytes, 8); return new UUID(l1, l2); }
/** * Factory method for constructing {@link java.util.UUID} instance from given * 16 bytes. * NOTE: since absolutely no validation is done for contents, this method should * only be used if contents are known to be valid. * * @param bytes Array that contains sequence of 16 bytes that contain a valid UUID * @param offset Offset of the first of 16 bytes */ public static UUID uuid(byte[] bytes, int offset) { _checkUUIDByteArray(bytes, offset); return new UUID(gatherLong(bytes, offset), gatherLong(bytes, offset+8)); }
/** * @param ethAddr Hardware address (802.1) to use for generating * spatially unique part of UUID. If system has more than one NIC, */ public TimeBasedGenerator(EthernetAddress ethAddr, UUIDTimer timer) { byte[] uuidBytes = new byte[16]; if (ethAddr == null) { ethAddr = EthernetAddress.constructMulticastAddress(); } // initialize baseline with MAC address info _ethernetAddress = ethAddr; _ethernetAddress.toByteArray(uuidBytes, 10); // and add clock sequence int clockSeq = timer.getClockSequence(); uuidBytes[UUIDUtil.BYTE_OFFSET_CLOCK_SEQUENCE] = (byte) (clockSeq >> 8); uuidBytes[UUIDUtil.BYTE_OFFSET_CLOCK_SEQUENCE+1] = (byte) clockSeq; long l2 = UUIDUtil.gatherLong(uuidBytes, 8); _uuidL2 = UUIDUtil.initUUIDSecondLong(l2); _timer = timer; }