コード例 #1
0
ファイル: UUID.java プロジェクト: Deeptiman/midpath4dingoo
 public static UUID convert16to32(UUID uuid) throws Exception {
   byte b[] = uuid.toByteArray();
   if (b.length != 2) throw new Exception("Not a 16-bits UUID!");
   UUID retour = new UUID();
   retour.uuidBytes = new byte[] {0, 0, 0, 0};
   for (int i = 2; i < 4; i++) retour.uuidBytes[i] += b[i - 2];
   retour.uuidLong = uuid.uuidLong;
   retour.uuidString = null;
   return retour;
 }
コード例 #2
0
ファイル: UUID.java プロジェクト: Deeptiman/midpath4dingoo
 public static UUID convert32to128(UUID uuid) {
   byte[] b = uuid.toByteArray();
   UUID retour = new UUID(b);
   if (b.length == 16) return retour;
   retour.uuidBytes = new byte[16];
   System.arraycopy(getBaseUUIDAsBytes(), 0, retour.uuidBytes, 0, 16);
   retour.uuidString = "";
   retour.uuidLong = 0;
   int decal = b.length == 2 ? 2 : 0;
   for (int i = 0; i < b.length; i++) {
     retour.uuidBytes[i + decal] += b[i];
   }
   return retour;
 }