List of utility methods to do UUID to Byte Array
String | uuidToBase58(UUID uuid) uuid To Base ByteBuffer bb = ByteBuffer.wrap(new byte[16]); bb.putLong(uuid.getMostSignificantBits()); bb.putLong(uuid.getLeastSignificantBits()); BigInteger number = new BigInteger(bb.array()).abs(); return encode58(number); |
byte[] | uuidToByteArray(UUID uuid) uuid To Byte Array ByteBuffer bb = ByteBuffer.wrap(new byte[16]); bb.putLong(uuid.getMostSignificantBits()); bb.putLong(uuid.getLeastSignificantBits()); return bb.array(); |
byte[] | uuidToBytes(UUID id) uuid To Bytes byte[] b = new byte[16]; return ByteBuffer.wrap(b).order(ByteOrder.BIG_ENDIAN).putLong(id.getMostSignificantBits()) .putLong(id.getLeastSignificantBits()).array(); |
byte[] | uuidToBytes(UUID uuid) uuid To Bytes byte[] bytes = new byte[16]; ByteBuffer buffer = ByteBuffer.wrap(bytes); buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.putInt((int) (uuid.getMostSignificantBits() >> 32)); buffer.putShort((short) (uuid.getMostSignificantBits() >> 16)); buffer.putShort((short) uuid.getMostSignificantBits()); buffer.order(ByteOrder.BIG_ENDIAN); buffer.putLong(uuid.getLeastSignificantBits()); ... |
byte[] | uuidToBytes(UUID uuid) Converts an UUID to byte array. byte[] bytes = new byte[(Long.SIZE >> 3) * 2]; uuidToBytes(uuid, bytes, 0); return bytes; |
byte[] | uuidToBytes(UUID uuid) Converts a UUID object to a byte array for storing in MySQL. ByteBuffer bb = ByteBuffer.wrap(new byte[16]); bb.putLong(uuid.getMostSignificantBits()); bb.putLong(uuid.getLeastSignificantBits()); return bb.array(); |
byte[] | uuidToBytesNullOk(UUID uuid) uuid To Bytes Null Ok if (uuid != null) { return bytes(uuid); return new byte[16]; |