mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
remove unused SingleUseBlobProvider.createUri()
This commit is contained in:
@@ -1,14 +1,10 @@
|
||||
package org.thoughtcrime.securesms.providers;
|
||||
|
||||
import android.content.ContentUris;
|
||||
import android.net.Uri;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -16,7 +12,6 @@ public class SingleUseBlobProvider {
|
||||
|
||||
public static final String AUTHORITY = "org.thoughtcrime.securesms";
|
||||
public static final String PATH = "memory/*/#";
|
||||
private static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/memory");
|
||||
|
||||
private final Map<Long, byte[]> cache = new HashMap<>();
|
||||
|
||||
@@ -28,18 +23,6 @@ public class SingleUseBlobProvider {
|
||||
|
||||
private SingleUseBlobProvider() {}
|
||||
|
||||
public synchronized Uri createUri(@NonNull byte[] blob) {
|
||||
try {
|
||||
long id = Math.abs(SecureRandom.getInstance("SHA1PRNG").nextLong());
|
||||
cache.put(id, blob);
|
||||
|
||||
Uri uniqueUri = Uri.withAppendedPath(CONTENT_URI, String.valueOf(System.currentTimeMillis()));
|
||||
return ContentUris.withAppendedId(uniqueUri, id);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized @NonNull InputStream getStream(long id) throws IOException {
|
||||
byte[] cached = cache.get(id);
|
||||
cache.remove(id);
|
||||
|
||||
Reference in New Issue
Block a user