Package com.ibm.di.server
Class ResourceHash
- java.lang.Object
-
- com.ibm.di.server.ResourceHash
-
public class ResourceHash extends java.lang.Object
Utility class for locating NLS strings. The strings have their special sequences (e.g. "\n", "\t") replaced with corresponding special characters (e.g. new line, tab).
-
-
Constructor Summary
Constructors Constructor Description ResourceHash(java.lang.String category)
ResourceHash(java.lang.String category, java.lang.String lang)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
escapeSpecialChars(java.lang.String str)
Replaces special characters such as new lines and tabs with special sequences such as "\n" and "\t".static java.lang.String
getDocument(java.lang.String path)
static ResourceHash
getHash(java.lang.String category)
static ResourceHash
getHash(java.lang.String category, java.lang.String acceptLang)
A ResourceHash specified by language.java.lang.String
getLanguage()
static java.net.URL
getResource(java.lang.String path)
java.lang.String
getString(java.lang.String resource)
Return the NLS string given the resourcejava.lang.String
getString(java.lang.String resource, java.lang.Object param)
Return the NLS string given the resource and a parameterjava.lang.String
getString(java.lang.String resource, java.lang.Object[] params)
Returns the NLS string value for the passed "resource" (key) and replaces the placeholders {0},{1},etc by the corresponding params[0],params[1],etc.static java.lang.String
substituteSpecialSequences(java.lang.String str)
Replaces special sequences with their corresponding special characters: "\n" with a new line, "\t" a with tab, etc.
-
-
-
Method Detail
-
getHash
public static ResourceHash getHash(java.lang.String category)
-
getHash
public static ResourceHash getHash(java.lang.String category, java.lang.String acceptLang)
A ResourceHash specified by language.- Parameters:
category
-acceptLang
- - As used in the HTTP Accept-Language header- Returns:
-
getDocument
public static java.lang.String getDocument(java.lang.String path)
-
getLanguage
public java.lang.String getLanguage()
-
getResource
public static java.net.URL getResource(java.lang.String path)
-
escapeSpecialChars
public static java.lang.String escapeSpecialChars(java.lang.String str)
Replaces special characters such as new lines and tabs with special sequences such as "\n" and "\t". It acts as an opposite of thesubstituteSpecialSequences
method.
- Parameters:
str
- a string, to work on- Returns:
- the string, having its special characters replaced
-
substituteSpecialSequences
public static java.lang.String substituteSpecialSequences(java.lang.String str)
Replaces special sequences with their corresponding special characters: "\n" with a new line, "\t" a with tab, etc. It acts as an opposite of theescapeSpecialChars
method.- Parameters:
str
- a String, to work on- Returns:
- the String, having its special sequences replaced
-
getString
public java.lang.String getString(java.lang.String resource)
Return the NLS string given the resource
-
getString
public java.lang.String getString(java.lang.String resource, java.lang.Object param)
Return the NLS string given the resource and a parameter
-
getString
public java.lang.String getString(java.lang.String resource, java.lang.Object[] params)
Returns the NLS string value for the passed "resource" (key) and replaces the placeholders {0},{1},etc by the corresponding params[0],params[1],etc.- Parameters:
resource
- The key whole value is to be retrieved.params
- An array of strings which will replace placeholders- Returns:
- The value with placeholders replaced.
-
-