Jalog 1.3


io.github.JalogTeam.jalog
Class Jalog.ResourceManager

java.lang.Object
  extended by io.github.JalogTeam.jalog.Jalog.ResourceManager
Enclosing class:
Jalog

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

getResourceAsStream

public static InputStream getResourceAsStream(String fileName)
          throws IOException
Provides a stream for reading a resource file.

Parameters:
filename - the name of the resource file.
Returns:
an input stream for reading a resource.
Throws:
IOException - propagated from I/O system.

Authors: Mikko Levanto, Ari Okkonen