mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-25 02:55:23 +00:00
32 lines
618 B
Java
32 lines
618 B
Java
|
package org.thoughtcrime.securesms.mms;
|
||
|
|
||
|
import android.content.ContentUris;
|
||
|
import android.net.Uri;
|
||
|
|
||
|
import org.thoughtcrime.securesms.database.PartDatabase;
|
||
|
import org.thoughtcrime.securesms.util.Hex;
|
||
|
|
||
|
import java.io.IOException;
|
||
|
|
||
|
public class PartUriParser {
|
||
|
|
||
|
private final Uri uri;
|
||
|
|
||
|
public PartUriParser(Uri uri) {
|
||
|
this.uri = uri;
|
||
|
}
|
||
|
|
||
|
public PartDatabase.PartId getPartId() {
|
||
|
return new PartDatabase.PartId(getId(), getUniqueId());
|
||
|
}
|
||
|
|
||
|
private long getId() {
|
||
|
return ContentUris.parseId(uri);
|
||
|
}
|
||
|
|
||
|
private long getUniqueId() {
|
||
|
return Long.parseLong(uri.getPathSegments().get(1));
|
||
|
}
|
||
|
|
||
|
}
|