java.lang.Object | |
↳ | com.facebook.common.util.UriUtil |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | DATA_SCHEME | Data scheme for URIs | |||||||||
String | HTTPS_SCHEME | ||||||||||
String | HTTP_SCHEME | http scheme for URIs | |||||||||
String | LOCAL_ASSET_SCHEME | Asset scheme for URIs | |||||||||
String | LOCAL_CONTENT_SCHEME | Content URI scheme for URIs | |||||||||
String | LOCAL_FILE_SCHEME | File scheme for URIs | |||||||||
String | LOCAL_RESOURCE_SCHEME | Resource scheme for URIs | |||||||||
String | QUALIFIED_RESOURCE_SCHEME | Resource scheme for fully qualified resources which might have a package name that is different than the application one. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
UriUtil() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static AssetFileDescriptor |
getAssetFileDescriptor(ContentResolver contentResolver, Uri srcUri)
Gets the AssetFileDescriptor for a local file.
| ||||||||||
static String |
getRealPathFromUri(ContentResolver contentResolver, Uri srcUri)
Get the path of a file from the Uri.
| ||||||||||
static String | getSchemeOrNull(Uri uri) | ||||||||||
static Uri |
getUriForFile(File file)
Returns a URI for a given file using
fromFile(File) . | ||||||||||
static Uri |
getUriForQualifiedResource(String packageName, int resourceId)
Returns a URI for the given resource ID in the given package.
| ||||||||||
static Uri |
getUriForResourceId(int resourceId)
Return a URI for the given resource ID.
| ||||||||||
static boolean |
isDataUri(Uri uri)
Check if the uri is a data uri
| ||||||||||
static boolean |
isLocalAssetUri(Uri uri)
Check if uri represents local asset
| ||||||||||
static boolean |
isLocalCameraUri(Uri uri)
Checks if the given URI is for a photo from the device's local media store.
| ||||||||||
static boolean |
isLocalContactUri(Uri uri)
Checks if the given URI is a general Contact URI, and not a specific display photo.
| ||||||||||
static boolean |
isLocalContentUri(Uri uri)
Check if uri represents local content
| ||||||||||
static boolean |
isLocalFileUri(Uri uri)
Check if uri represents local file
| ||||||||||
static boolean |
isLocalResourceUri(Uri uri)
Check if uri represents local resource
| ||||||||||
static boolean |
isNetworkUri(Uri uri)
Check if uri represents network resource
| ||||||||||
static boolean |
isQualifiedResourceUri(Uri uri)
Check if uri represents fully qualified resource URI.
| ||||||||||
static Uri |
parseUriOrNull(String uriAsString)
A wrapper around
parse(String) that returns null if the input is null. | ||||||||||
static URL |
uriToUrl(Uri uri)
Convert android.net.Uri to java.net.URL as necessary for some networking APIs.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Data scheme for URIs
http scheme for URIs
Asset scheme for URIs
Content URI scheme for URIs
File scheme for URIs
Resource scheme for URIs
Resource scheme for fully qualified resources which might have a package name that is different than the application one. This has the constant value of "android.resource".
Gets the AssetFileDescriptor for a local file. This offers an alternative solution for opening content:// scheme files
contentResolver | the content resolver which will query for the source file |
---|---|
srcUri | The source uri |
Get the path of a file from the Uri.
contentResolver | the content resolver which will query for the source file |
---|---|
srcUri | The source uri |
uri | uri to extract scheme from, possibly null |
---|
Returns a URI for a given file using fromFile(File)
.
file | a file with a valid path |
---|
Returns a URI for the given resource ID in the given package. Use this method only if you need to specify a package name different to your application's main package.
packageName | a package name (e.g. com.facebook.myapp.plugin) |
---|---|
resourceId | to resource ID to use |
Return a URI for the given resource ID. The returned URI consists of a LOCAL_RESOURCE_SCHEME
scheme and the resource ID as path.
resourceId | the resource ID to use |
---|
Check if the uri is a data uri
Check if uri represents local asset
uri | uri to check |
---|
Checks if the given URI is for a photo from the device's local media store.
uri | the URI to check |
---|
Checks if the given URI is a general Contact URI, and not a specific display photo.
uri | the URI to check |
---|
Check if uri represents local content
uri | uri to check |
---|
Check if uri represents local file
uri | uri to check |
---|
Check if uri represents local resource
uri | uri to check |
---|
LOCAL_RESOURCE_SCHEME
Check if uri represents network resource
uri | uri to check |
---|
Check if uri represents fully qualified resource URI.
uri | uri to check |
---|
QUALIFIED_RESOURCE_SCHEME
A wrapper around parse(String)
that returns null if the input is null.
uriAsString | the uri as a string |
---|
Convert android.net.Uri to java.net.URL as necessary for some networking APIs.
uri | uri to convert |
---|