Jalog 1.3
java.lang.Object io.github.JalogTeam.jalog.Jalog.ResourceManager
public class Jalog.ResourceManager
Jalog uses ResourceManager to read resource files. ResourceManager may be redefined to read from nonstandard resource organization, e.g. in Android systems.
In order to read resources from a nonstandard place, two things are needed. First,
a new class is derived from Jalog.ResourceManager
. The function
getResourceAsStream
must be overridden so that resources are read
from their actual location. For example, in Android, the following declaration
can be used:
class MyResourceManager extends Jalog.ResourceManager { public InputStream getResourceAsStream(String fileName) throws IOException { return getResources().getAssets().open(fileName); } }
Secondly, the new resource manager is introduced to Jalog with
setResourceManager
before any Jalog code is called. For example,
continuing the above example, the following instructions can be used:
Jalog myJalog = new Jalog() ; myJalog.setResourceManager(new MyResourceManager());
Method Summary | |
---|---|
InputStream
|
getResourceAsStream(String fileName)
NOTE: For internal use of the Jalog system. Not to be called by a application program. This is provided to facilitate redefinition when used in nonstandard resource file environment, e.g. in Android systems. Opens a resource for reading. |
Method Detail |
---|
public static InputStream getResourceAsStream(String fileName) throws IOException
filename
- the name of the resource file.IOException
- propagated from I/O system.