This singleton class handles file access to APK assets. More...
Classes | |
class | ResourceFile |
Resource File. More... | |
Public Member Functions | |
void | APKCloseFile (ResourceFile file) |
Closes the input stream in given ResourceFile and releases associated resources. | |
long | APKGetFileLength (ResourceFile file) |
Returns the total number of bytes of ResourceFile's data. | |
ResourceFile | APKOpenFile (String filename) |
Creates a ResourceFile object containing an open InputStream for the given filename in context set by com.rightware.kanzi.KanziResourceFile#setContext(Context) . | |
long | APKReadFile (ResourceFile file, int size) |
Reads the specified number of bytes from a given ResourceFile. | |
long | APKSkipFile (ResourceFile file, int offset) |
Skips over and discards a number bytes of data from ResourceFile's input stream. | |
Context | getContext () |
Returns the context which have been set using com.rightware.kanzi.KanziResourceFile#setContext(Context) . | |
void | setContext (Context context) |
Sets the context of KanziResourceFile. | |
Static Public Member Functions | |
static KanziResourceFile | getInstance () |
Returns an instance of KanziResourceFile. | |
This singleton class handles file access to APK assets.
void APKCloseFile | ( | ResourceFile | file | ) |
Closes the input stream in given ResourceFile and releases associated resources.
file | ResourceFile to close. |
long APKGetFileLength | ( | ResourceFile | file | ) |
Returns the total number of bytes of ResourceFile's data.
May be com.rightware.kanzi.AssetFileDescriptor#UNKNOWN_LENGTH
if the asset extends to the end of the file.
file | ResourceFile to query. |
ResourceFile APKOpenFile | ( | String | filename | ) |
Creates a ResourceFile object containing an open InputStream for the given filename in context set by com.rightware.kanzi.KanziResourceFile#setContext(Context)
.
filename | A resource file in APK to be opened. |
long APKReadFile | ( | ResourceFile | file, |
int | size ) |
Reads the specified number of bytes from a given ResourceFile.
Reallocates the byte buffer in ResourceFile to size
bytes, if requested size is larger than the previously allocated size of ResourceFile.
file | ResourceFile with open InputStream to read. |
size | Read buffer size in bytes. |
long APKSkipFile | ( | ResourceFile | file, |
int | offset ) |
Skips over and discards a number bytes of data from ResourceFile's input stream.
The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. The actual number of bytes skipped is returned. If offset is negative, this method returns 0, and no bytes are skipped.
file | ResourceFile to read. |
offset | Number of bytes to skip. |
Context getContext | ( | ) |
Returns the context which have been set using com.rightware.kanzi.KanziResourceFile#setContext(Context)
.
|
static |
Returns an instance of KanziResourceFile.
Before using the returned instance for the first time, context has to be set once using com.rightware.kanzi.KanziResourceFile#setContext(Context)
. Context defaults to null and com.rightware.kanzi.KanziResourceFile#APKOpenFile(String)
requests will fail until set.
void setContext | ( | Context | context | ) |
Sets the context of KanziResourceFile.
context | The application's context utilizing KanziResourceFile's services. |