public class CordovaResourceApi
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CordovaResourceApi.OpenForReadResult |
Modifier and Type | Field and Description |
---|---|
static java.lang.Thread |
jsThread |
static java.lang.String |
PLUGIN_URI_SCHEME |
static int |
URI_TYPE_ASSET |
static int |
URI_TYPE_CONTENT |
static int |
URI_TYPE_DATA |
static int |
URI_TYPE_FILE |
static int |
URI_TYPE_HTTP |
static int |
URI_TYPE_HTTPS |
static int |
URI_TYPE_PLUGIN |
static int |
URI_TYPE_RESOURCE |
static int |
URI_TYPE_UNKNOWN |
Constructor and Description |
---|
CordovaResourceApi(android.content.Context context,
PluginManager pluginManager) |
Modifier and Type | Method and Description |
---|---|
void |
copyResource(CordovaResourceApi.OpenForReadResult input,
java.io.OutputStream outputStream) |
void |
copyResource(android.net.Uri sourceUri,
java.io.OutputStream outputStream) |
void |
copyResource(android.net.Uri sourceUri,
android.net.Uri dstUri) |
java.net.HttpURLConnection |
createHttpConnection(android.net.Uri uri) |
java.lang.String |
getMimeType(android.net.Uri uri) |
static int |
getUriType(android.net.Uri uri) |
boolean |
isThreadCheckingEnabled() |
java.io.File |
mapUriToFile(android.net.Uri uri)
Returns a File that points to the resource, or null if the resource
is not on the local filesystem.
|
CordovaResourceApi.OpenForReadResult |
openForRead(android.net.Uri uri)
Opens a stream to the given URI, also providing the MIME type & length.
|
CordovaResourceApi.OpenForReadResult |
openForRead(android.net.Uri uri,
boolean skipThreadCheck)
Opens a stream to the given URI, also providing the MIME type & length.
|
java.io.OutputStream |
openOutputStream(android.net.Uri uri) |
java.io.OutputStream |
openOutputStream(android.net.Uri uri,
boolean append)
Opens a stream to the given URI.
|
java.lang.String |
remapPath(java.lang.String path) |
android.net.Uri |
remapUri(android.net.Uri uri) |
void |
setThreadCheckingEnabled(boolean value) |
public static final int URI_TYPE_FILE
public static final int URI_TYPE_ASSET
public static final int URI_TYPE_CONTENT
public static final int URI_TYPE_RESOURCE
public static final int URI_TYPE_DATA
public static final int URI_TYPE_HTTP
public static final int URI_TYPE_HTTPS
public static final int URI_TYPE_PLUGIN
public static final int URI_TYPE_UNKNOWN
public static final java.lang.String PLUGIN_URI_SCHEME
public static java.lang.Thread jsThread
public CordovaResourceApi(android.content.Context context, PluginManager pluginManager)
public void setThreadCheckingEnabled(boolean value)
public boolean isThreadCheckingEnabled()
public static int getUriType(android.net.Uri uri)
public android.net.Uri remapUri(android.net.Uri uri)
public java.lang.String remapPath(java.lang.String path)
public java.io.File mapUriToFile(android.net.Uri uri)
public java.lang.String getMimeType(android.net.Uri uri)
public CordovaResourceApi.OpenForReadResult openForRead(android.net.Uri uri) throws java.io.IOException
Throws
- an InvalidArgumentException for relative URIs. Relative URIs should be
resolved before being passed into this function.Throws
- an IOException if the URI cannot be opened.Throws
- an IllegalStateException if called on a foreground thread.java.io.IOException
public CordovaResourceApi.OpenForReadResult openForRead(android.net.Uri uri, boolean skipThreadCheck) throws java.io.IOException
Throws
- an InvalidArgumentException for relative URIs. Relative URIs should be
resolved before being passed into this function.Throws
- an IOException if the URI cannot be opened.Throws
- an IllegalStateException if called on a foreground thread and skipThreadCheck is false.java.io.IOException
public java.io.OutputStream openOutputStream(android.net.Uri uri) throws java.io.IOException
java.io.IOException
public java.io.OutputStream openOutputStream(android.net.Uri uri, boolean append) throws java.io.IOException
Throws
- an InvalidArgumentException for relative URIs. Relative URIs should be
resolved before being passed into this function.Throws
- an IOException if the URI cannot be opened.java.io.IOException
public java.net.HttpURLConnection createHttpConnection(android.net.Uri uri) throws java.io.IOException
java.io.IOException
public void copyResource(CordovaResourceApi.OpenForReadResult input, java.io.OutputStream outputStream) throws java.io.IOException
java.io.IOException
public void copyResource(android.net.Uri sourceUri, java.io.OutputStream outputStream) throws java.io.IOException
java.io.IOException
public void copyResource(android.net.Uri sourceUri, android.net.Uri dstUri) throws java.io.IOException
java.io.IOException