java.lang.Object | |
↳ | android.content.res.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 Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AssetManager.AssetInputStream |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ACCESS_BUFFER | Mode for open(String, int) : Attempt to load contents into
memory, for fast small reads. |
|||||||||
int | ACCESS_RANDOM | Mode for open(String, int) : Read chunks, and seek forward and
backward. |
|||||||||
int | ACCESS_STREAMING | Mode for open(String, int) : Read sequentially, with an
occasional forward seek. |
|||||||||
int | ACCESS_UNKNOWN | Mode for open(String, int) : no specific information about how
data will be accessed. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Close this asset manager.
| |||||||||||
Get the locales that this asset manager contains data for.
| |||||||||||
Return a String array of all the assets at the given path.
| |||||||||||
Open an asset using ACCESS_STREAMING mode.
| |||||||||||
Open an asset using an explicit access mode, returning an InputStream to
read its contents.
| |||||||||||
Retrieve a parser for a compiled XML file.
| |||||||||||
Retrieve a parser for a compiled XML file.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called before the object's memory is reclaimed by the VM.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Mode for open(String, int)
: Attempt to load contents into
memory, for fast small reads.
Mode for open(String, int)
: Read chunks, and seek forward and
backward.
Mode for open(String, int)
: Read sequentially, with an
occasional forward seek.
Mode for open(String, int)
: no specific information about how
data will be accessed.
Get the locales that this asset manager contains data for.
Return a String array of all the assets at the given path.
path | A relative path within the assets, i.e., "docs/home.html". |
---|
IOException |
---|
Open an asset using ACCESS_STREAMING mode. This provides access to files that have been bundled with an application as assets -- that is, files placed in to the "assets" directory.
fileName | The name of the asset to open. This name can be hierarchical. |
---|
IOException |
---|
Open an asset using an explicit access mode, returning an InputStream to read its contents. This provides access to files that have been bundled with an application as assets -- that is, files placed in to the "assets" directory.
fileName | The name of the asset to open. This name can be hierarchical. |
---|---|
accessMode | Desired access mode for retrieving the data. |
IOException |
---|
IOException |
---|
IOException |
---|
Retrieve a parser for a compiled XML file.
fileName | The name of the file to retrieve. |
---|
IOException |
---|
Retrieve a parser for a compiled XML file.
cookie | Identifier of the package to be opened. |
---|---|
fileName | The name of the file to retrieve. |
IOException |
---|
Called before the object's memory is reclaimed by the VM. This can only happen once the garbage collector has detected that the object is no longer reachable by any thread of the running application.
The method can be used to free system resources or perform other cleanup
before the object is garbage collected. The default implementation of the
method is empty, which is also expected by the VM, but subclasses can
override finalize()
as required. Uncaught exceptions which are
thrown during the execution of this method cause it to terminate
immediately but are otherwise ignored.
Note that the VM does guarantee that finalize()
is called at most
once for any object, but it doesn't guarantee when (if at all) finalize()
will be called. For example, object B's finalize()
can delay the execution of object A's finalize()
method and
therefore it can delay the reclamation of A's memory. To be safe, use a
ReferenceQueue
, because it provides more control
over the way the VM deals with references during garbage collection.
Throwable |
---|