ContentProvider can now lookup tracks via UUID.

This commit is contained in:
Dennis Guse
2020-08-15 08:45:00 +02:00
parent c26a5edc03
commit 5c96774e79
6 changed files with 52 additions and 5 deletions
@@ -20,4 +20,19 @@ public class UUIDUtils {
byteBuffer.putLong(uuid.getLeastSignificantBits());
return byteBuffer.array();
}
private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
public static String toHex(@NonNull UUID uuid) {
byte[] bytes = toBytes(uuid);
char[] hexChars = new char[bytes.length * 2];
for (int i = 0; i < bytes.length; i++) {
int v = bytes[i] & 0xFF;
hexChars[i * 2] = HEX_ARRAY[v >>> 4];
hexChars[i * 2 + 1] = HEX_ARRAY[v & 0x0F];
}
return new String(hexChars);
}
}