net.sourceforge.jwap.util
Class TransTable

java.lang.Object
  |
  +--net.sourceforge.jwap.util.TransTable

public class TransTable
extends java.lang.Object

This class represent a translation table that may be used to convert well-known integer values to their corresponding string representation.

Author:
Michel Marti

Field Summary
static java.lang.String RESOURCE_PKG
          RESOURCE_PKG is the name of the constant holding the value "/net/sourceforge/jwap/resources"
 
Method Summary
 java.lang.String code2str(int mib)
          Lookup the string representation of a code in the translation table
static TransTable getTable(java.lang.String table)
          Get a specific translation table.
 java.lang.Integer str2code(java.lang.String str)
          Lookup the integer representation of a code
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_PKG

public static final java.lang.String RESOURCE_PKG
RESOURCE_PKG is the name of the constant holding the value "/net/sourceforge/jwap/resources"
Method Detail

getTable

public static TransTable getTable(java.lang.String table)
                           throws java.lang.RuntimeException
Get a specific translation table. This method uses the class-loader to load the table from a properties file. If the given name is not fully qualified, getTable will lookup the resource in the jWAP's default resource package (net.sourceforge.jwap.resources).
Parameters:
name - the (fully qualified) resource name of the properties holding the table
Returns:
a TransTable object
Throws:
java.lang.RuntimeException - if the resource cannot be loaded

code2str

public java.lang.String code2str(int mib)
Lookup the string representation of a code in the translation table
Parameters:
mib - the code to lookup
Returns:
the string representation or null if unknown

str2code

public java.lang.Integer str2code(java.lang.String str)
Lookup the integer representation of a code
Parameters:
str - the code to lookup
Returns:
the integer representation or null if unknown