|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.content.res.AssetManager
public final class AssetManager
Provides access to an application's raw asset files; see Resources
for the way most applications will want to retrieve their resource data.
This class presents a lower-level API that allows you to open and read raw
files that have been bundled with the application as a simple stream of
bytes.
| Nested Class Summary | |
|---|---|
class |
AssetManager.AssetInputStream
|
| Field Summary | |
|---|---|
static int |
ACCESS_BUFFER
Mode for open(String, int): Attempt to load contents into
memory, for fast small reads. |
static int |
ACCESS_RANDOM
Mode for open(String, int): Read chunks, and seek forward and
backward. |
static int |
ACCESS_STREAMING
Mode for open(String, int): Read sequentially, with an
occasional forward seek. |
static int |
ACCESS_UNKNOWN
Mode for open(String, int): no specific information about how
data will be accessed. |
(package private) static int |
STYLE_ASSET_COOKIE
|
(package private) static int |
STYLE_CHANGING_CONFIGURATIONS
|
(package private) static int |
STYLE_DATA
|
(package private) static int |
STYLE_NUM_ENTRIES
|
(package private) static int |
STYLE_RESOURCE_ID
|
(package private) static int |
STYLE_TYPE
|
| Constructor Summary | |
|---|---|
AssetManager()
Create a new AssetManager containing only the basic system assets. |
|
| Method Summary | |
|---|---|
int |
addAssetPath(String path)
Add an additional set of assets to the asset manager. |
(package private) static boolean |
applyStyle(int theme,
int defStyleAttr,
int defStyleRes,
int xmlParser,
int[] inAttrs,
int[] outValues,
int[] outIndices)
|
(package private) static void |
applyThemeStyle(int theme,
int styleRes,
boolean force)
|
void |
close()
Close this asset manager. |
(package private) static void |
copyTheme(int dest,
int source)
|
(package private) int |
createTheme()
|
(package private) static void |
dumpTheme(int theme,
int priority,
String tag,
String prefix)
|
(package private) void |
ensureStringBlocks()
|
protected void |
finalize()
Called by the virtual machine when there are no longer any (non-weak) references to the receiver. |
(package private) int[] |
getArrayIntResource(int arrayRes)
|
(package private) int |
getArraySize(int resource)
|
String |
getCookieName(int cookie)
|
static int |
getGlobalAssetCount()
|
static int |
getGlobalAssetManagerCount()
|
String[] |
getLocales()
Get the locales that this asset manager contains data for. |
(package private) CharSequence |
getPooledString(int block,
int id)
|
(package private) CharSequence |
getResourceBagText(int ident,
int bagEntryId)
Retrieve the string value associated with a particular resource identifier for the current configuration / skin. |
(package private) String |
getResourceEntryName(int resid)
|
(package private) int |
getResourceIdentifier(String type,
String name,
String defPackage)
Retrieve the resource identifier for the given resource name. |
(package private) String |
getResourceName(int resid)
|
(package private) String |
getResourcePackageName(int resid)
|
(package private) String[] |
getResourceStringArray(int id)
Retrieve the string array associated with a particular resource identifier. |
(package private) CharSequence |
getResourceText(int ident)
Retrieve the string value associated with a particular resource identifier for the current configuration / skin. |
(package private) CharSequence[] |
getResourceTextArray(int id)
Retrieve the text array associated with a particular resource identifier. |
(package private) String |
getResourceTypeName(int resid)
|
(package private) boolean |
getResourceValue(int ident,
TypedValue outValue,
boolean resolveRefs)
|
static AssetManager |
getSystem()
Return a global shared asset manager that provides access to only system assets (no application assets). |
(package private) boolean |
getThemeValue(int theme,
int ident,
TypedValue outValue,
boolean resolveRefs)
|
boolean |
isUpToDate()
Determine whether the state in this asset manager is up-to-date with the files on the filesystem. |
String[] |
list(String path)
Return a String array of all the assets at the given path. |
(package private) static int |
loadThemeAttributeValue(int theme,
int ident,
TypedValue outValue,
boolean resolve)
|
InputStream |
open(String fileName)
Open an asset using ACCESS_STREAMING mode. |
InputStream |
open(String fileName,
int accessMode)
Open an asset using an explicit access mode, returning an InputStream to read its contents. |
AssetFileDescriptor |
openFd(String fileName)
|
InputStream |
openNonAsset(int cookie,
String fileName)
Open a non-asset in a specified package. |
InputStream |
openNonAsset(int cookie,
String fileName,
int accessMode)
Open a non-asset in a specified package. |
InputStream |
openNonAsset(String fileName)
Open a non-asset file as an asset using ACCESS_STREAMING mode. |
InputStream |
openNonAsset(String fileName,
int accessMode)
Open a non-asset file as an asset using a specific access mode. |
AssetFileDescriptor |
openNonAssetFd(int cookie,
String fileName)
|
AssetFileDescriptor |
openNonAssetFd(String fileName)
|
(package private) XmlBlock |
openXmlBlockAsset(int cookie,
String fileName)
Retrieve a non-asset as a compiled XML file. |
(package private) XmlBlock |
openXmlBlockAsset(String fileName)
Retrieve a non-asset as a compiled XML file. |
XmlResourceParser |
openXmlResourceParser(int cookie,
String fileName)
Retrieve a parser for a compiled XML file. |
XmlResourceParser |
openXmlResourceParser(String fileName)
Retrieve a parser for a compiled XML file. |
(package private) void |
releaseTheme(int theme)
|
(package private) int |
retrieveArray(int resource,
int[] outValues)
|
(package private) boolean |
retrieveAttributes(int xmlParser,
int[] inAttrs,
int[] outValues,
int[] outIndices)
|
void |
setConfiguration(int mcc,
int mnc,
String locale,
int orientation,
int touchscreen,
int density,
int keyboard,
int keyboardHidden,
int navigation,
int screenWidth,
int screenHeight,
int majorVersion)
Change the configuation used when retrieving resources. |
void |
setLocale(String locale)
Change the locale being used by this asset manager. |
(package private) void |
xmlBlockGone()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ACCESS_UNKNOWN
open(String, int): no specific information about how
data will be accessed.
public static final int ACCESS_RANDOM
open(String, int): Read chunks, and seek forward and
backward.
public static final int ACCESS_STREAMING
open(String, int): Read sequentially, with an
occasional forward seek.
public static final int ACCESS_BUFFER
open(String, int): Attempt to load contents into
memory, for fast small reads.
static final int STYLE_NUM_ENTRIES
static final int STYLE_TYPE
static final int STYLE_DATA
static final int STYLE_ASSET_COOKIE
static final int STYLE_RESOURCE_ID
static final int STYLE_CHANGING_CONFIGURATIONS
| Constructor Detail |
|---|
public AssetManager()
Resources.getAssets(). Not for
use by applications.
| Method Detail |
|---|
public static AssetManager getSystem()
public void close()
final CharSequence getResourceText(int ident)
final CharSequence getResourceBagText(int ident,
int bagEntryId)
final String[] getResourceStringArray(int id)
id - Resource id of the string array
final boolean getResourceValue(int ident,
TypedValue outValue,
boolean resolveRefs)
final CharSequence[] getResourceTextArray(int id)
id - Resource id of the string array
final boolean getThemeValue(int theme,
int ident,
TypedValue outValue,
boolean resolveRefs)
final void ensureStringBlocks()
final CharSequence getPooledString(int block,
int id)
public final InputStream open(String fileName)
throws IOException
fileName - The name of the asset to open. This name can be
hierarchical.
IOExceptionopen(String, int),
list(java.lang.String)
public final InputStream open(String fileName,
int accessMode)
throws IOException
fileName - The name of the asset to open. This name can be
hierarchical.accessMode - Desired access mode for retrieving the data.
IOExceptionACCESS_UNKNOWN,
ACCESS_STREAMING,
ACCESS_RANDOM,
ACCESS_BUFFER,
open(String),
list(java.lang.String)
public final AssetFileDescriptor openFd(String fileName)
throws IOException
IOException
public final String[] list(String path)
throws IOException
path - A relative path within the assets, i.e., "docs/home.html".
IOExceptionopen(java.lang.String)
public final InputStream openNonAsset(String fileName)
throws IOException
IOExceptionopen(String)
public final InputStream openNonAsset(String fileName,
int accessMode)
throws IOException
IOExceptionopen(String, int)
public final InputStream openNonAsset(int cookie,
String fileName)
throws IOException
cookie - Identifier of the package to be opened.fileName - Name of the asset to retrieve.
IOException
public final InputStream openNonAsset(int cookie,
String fileName,
int accessMode)
throws IOException
cookie - Identifier of the package to be opened.fileName - Name of the asset to retrieve.accessMode - Desired access mode for retrieving the data.
IOException
public final AssetFileDescriptor openNonAssetFd(String fileName)
throws IOException
IOException
public final AssetFileDescriptor openNonAssetFd(int cookie,
String fileName)
throws IOException
IOException
public final XmlResourceParser openXmlResourceParser(String fileName)
throws IOException
fileName - The name of the file to retrieve.
IOException
public final XmlResourceParser openXmlResourceParser(int cookie,
String fileName)
throws IOException
cookie - Identifier of the package to be opened.fileName - The name of the file to retrieve.
IOException
final XmlBlock openXmlBlockAsset(String fileName)
throws IOException
fileName - The name of the file to retrieve.
IOException
final XmlBlock openXmlBlockAsset(int cookie,
String fileName)
throws IOException
cookie - Identifier of the package to be opened.fileName - Name of the asset to retrieve.
IOExceptionvoid xmlBlockGone()
final int createTheme()
final void releaseTheme(int theme)
protected void finalize()
throws Throwable
ObjectNote: The virtual machine assumes that the implementation in class Object is empty.
finalize in class ObjectThrowable - The virtual machine ignores any exceptions which are
thrown during finalization.public final int addAssetPath(String path)
public final boolean isUpToDate()
public final void setLocale(String locale)
public final String[] getLocales()
public final void setConfiguration(int mcc,
int mnc,
String locale,
int orientation,
int touchscreen,
int density,
int keyboard,
int keyboardHidden,
int navigation,
int screenWidth,
int screenHeight,
int majorVersion)
final int getResourceIdentifier(String type,
String name,
String defPackage)
final String getResourceName(int resid)
final String getResourcePackageName(int resid)
final String getResourceTypeName(int resid)
final String getResourceEntryName(int resid)
static final boolean applyStyle(int theme,
int defStyleAttr,
int defStyleRes,
int xmlParser,
int[] inAttrs,
int[] outValues,
int[] outIndices)
final boolean retrieveAttributes(int xmlParser,
int[] inAttrs,
int[] outValues,
int[] outIndices)
final int getArraySize(int resource)
final int retrieveArray(int resource,
int[] outValues)
public final String getCookieName(int cookie)
public static final int getGlobalAssetCount()
public static final int getGlobalAssetManagerCount()
static final void applyThemeStyle(int theme,
int styleRes,
boolean force)
static final void copyTheme(int dest,
int source)
static final int loadThemeAttributeValue(int theme,
int ident,
TypedValue outValue,
boolean resolve)
static final void dumpTheme(int theme,
int priority,
String tag,
String prefix)
final int[] getArrayIntResource(int arrayRes)
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||