2021-07-24 02:37:17 +00:00
|
|
|
package androidx.core.net;
|
|
|
|
|
|
|
|
import android.net.Uri;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import java.io.File;
|
|
|
|
/* compiled from: Uri.kt */
|
|
|
|
public final class UriKt {
|
|
|
|
public static final File toFile(Uri uri) {
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullParameter(uri, "<this>");
|
2021-07-24 02:37:17 +00:00
|
|
|
if (m.areEqual(uri.getScheme(), "file")) {
|
|
|
|
String path = uri.getPath();
|
|
|
|
if (path != null) {
|
|
|
|
return new File(path);
|
|
|
|
}
|
2021-09-21 07:33:49 +00:00
|
|
|
throw new IllegalArgumentException(m.stringPlus("Uri path is null: ", uri).toString());
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
2021-09-21 07:33:49 +00:00
|
|
|
throw new IllegalArgumentException(m.stringPlus("Uri lacks 'file' scheme: ", uri).toString());
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static final Uri toUri(File file) {
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullParameter(file, "<this>");
|
2021-07-24 02:37:17 +00:00
|
|
|
Uri fromFile = Uri.fromFile(file);
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullExpressionValue(fromFile, "fromFile(this)");
|
2021-07-24 02:37:17 +00:00
|
|
|
return fromFile;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final Uri toUri(String str) {
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullParameter(str, "<this>");
|
2021-07-24 02:37:17 +00:00
|
|
|
Uri parse = Uri.parse(str);
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullExpressionValue(parse, "parse(this)");
|
2021-07-24 02:37:17 +00:00
|
|
|
return parse;
|
|
|
|
}
|
|
|
|
}
|