@Test public void toByteArray_alternativeValues() throws IOException { UUID uuid = UUID.fromString("b70df6ac-3b21-4b39-a514-613561f51e2a"); byte[] serialized = UuidUtil.toByteArray(uuid); assertArrayEquals(Hex.fromStringCondensed("b70df6ac3b214b39a514613561f51e2a"), serialized); }
public static byte[] toByteArray(UUID uuid) { ByteBuffer buffer = ByteBuffer.wrap(new byte[16]); buffer.putLong(uuid.getMostSignificantBits()); buffer.putLong(uuid.getLeastSignificantBits()); return buffer.array(); }
UuidUtil { public static byte[] toByteArray(UUID uuid) { ByteBuffer buffer = ByteBuffer.wrap(new byte[16]); buffer.putLong(uuid.getMostSignificantBits()); buffer.putLong(uuid.getLeastSignificantBits()); return buffer.array(); } }
UuidUtil { public static byte[] toByteArray(UUID uuid) { ByteBuffer buffer = ByteBuffer.wrap(new byte[16]); buffer.putLong(uuid.getMostSignificantBits()); buffer.putLong(uuid.getLeastSignificantBits()); return buffer.array(); } private  UuidUtil(); }
UuidUtil { public static byte[] toByteArray(UUID uuid) { ByteBuffer buffer = ByteBuffer.wrap(new byte[16]); buffer.putLong(uuid.getMostSignificantBits()); buffer.putLong(uuid.getLeastSignificantBits()); return buffer.array(); } private  UuidUtil(); static Optional<UUID> parse(String uuid); static UUID parseOrNull(String uuid); static UUID parseOrThrow(String uuid); static UUID parseOrThrow(byte[] bytes); static boolean isUuid(String uuid); static byte[] toByteArray(UUID uuid); static ByteString toByteString(UUID uuid); static UUID fromByteString(ByteString bytes); static UUID fromByteStringOrNull(ByteString bytes); static UUID fromByteStringOrUnknown(ByteString bytes); static List<UUID> fromByteStrings(Collection<ByteString> byteStringCollection); static List<UUID> filterKnown(Collection<UUID> uuids); }
UuidUtil { public static byte[] toByteArray(UUID uuid) { ByteBuffer buffer = ByteBuffer.wrap(new byte[16]); buffer.putLong(uuid.getMostSignificantBits()); buffer.putLong(uuid.getLeastSignificantBits()); return buffer.array(); } private  UuidUtil(); static Optional<UUID> parse(String uuid); static UUID parseOrNull(String uuid); static UUID parseOrThrow(String uuid); static UUID parseOrThrow(byte[] bytes); static boolean isUuid(String uuid); static byte[] toByteArray(UUID uuid); static ByteString toByteString(UUID uuid); static UUID fromByteString(ByteString bytes); static UUID fromByteStringOrNull(ByteString bytes); static UUID fromByteStringOrUnknown(ByteString bytes); static List<UUID> fromByteStrings(Collection<ByteString> byteStringCollection); static List<UUID> filterKnown(Collection<UUID> uuids); static final UUID UNKNOWN_UUID; }