Last active
August 2, 2017 14:27
-
-
Save jeffypooo/10922165432ec016a823e46c6eb382e6 to your computer and use it in GitHub Desktop.
Byte swaps a UUID as workaround for https://code.google.com/p/android/issues/detail?id=197341#makechanges
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Workaround for https://code.google.com/p/android/issues/detail?id=197341 | |
*/ | |
private UUID byteSwappedUuid(UUID toSwap) { | |
ByteBuffer buffer = ByteBuffer.allocate(16); | |
buffer | |
.putLong(toSwap.getLeastSignificantBits()) | |
.putLong(toSwap.getMostSignificantBits()); | |
buffer.rewind(); | |
buffer.order(ByteOrder.LITTLE_ENDIAN); | |
return new UUID(buffer.getLong(), buffer.getLong()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment