|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.isogen.i18nsupport.I18nUtil
| Constructor Summary | |
I18nUtil()
|
|
| Method Summary | |
static java.lang.String |
byteToHex(byte b)
Converts a byte to the string representation of its hex value. |
static java.lang.String |
charToHex(char c)
Returns hex String representation of char c, that is, the hex digits of the Unicode code point for the character. |
static java.lang.String |
echoEndTag(org.w3c.dom.Element elem)
Given an element, returns the end tag as a string. |
static java.lang.String |
echoStartTag(org.w3c.dom.Element elem)
Given an element, returns the start tag as a string, including any attributes. |
static java.lang.String |
escapeUnicodeString(java.lang.String inString)
Given a string containing non-ASCII Unicode characters, returns the same string will all non-ASCII characters replaced with "\\uxxxx" reflecting their Unicode code points. |
static org.w3c.dom.Element |
getAttHolder(org.w3c.dom.Element startNode,
java.lang.String attName)
Returns element that exhibits the specified attribute, walking up the element hierarchy. |
static org.w3c.dom.Element |
getElement(org.w3c.dom.Element parentElem,
java.lang.String tagName)
Returns the element with the specified tag name. |
static java.lang.String |
getElementContent(org.w3c.dom.Element elem)
Returns the string content of an element (e.g., xsl:value-of()). |
static java.lang.String |
getElementContentNormalized(org.w3c.dom.Element elem)
Returns the string content of an element with newlines normalized to single space characters. |
static java.lang.String |
getElementLanguage(org.w3c.dom.Element elemNode,
java.lang.String defaultLangCode)
Returns the language code associated with the specified element. |
static org.w3c.dom.Element |
getFirstElementChild(org.w3c.dom.Element elemNode)
Returns the first element node within the children of the specified element. |
static int |
getIntForHexChar(char hexChar)
Returns the int value of a character that is a hex digit |
static java.lang.String |
getLangAttName()
Returns the value of the langAttName property. |
static java.util.Locale |
getLocaleFromLangCode(java.lang.String langCode)
Given a "language" code consisting of an ISO 639 two-character language code and, optionally, an ISO 3166 country code, separated by a hyphen (e.g, "ar", "zh-CN"), returns the built-in (to Java) Locale with the matching language and country code. |
static boolean |
hasElementChildren(org.w3c.dom.Element elemNode)
Returns true if the input element has element children. |
static byte[] |
hexToBytes(java.lang.String hexString)
Given a hex string ("A012EBCD"), returns the bytes it represents. |
static void |
main(java.lang.String[] args)
|
static java.lang.String |
readUnicodeFile(java.io.File file,
java.lang.String encoding)
Reads the specified file as a Unicode string in the specified encoding. |
static java.lang.String |
readUnicodeFile(java.lang.String filePath,
java.lang.String encoding)
Reads the file at the specified path as a Unicode string in the specified encoding. |
static java.lang.String |
readUnicodeFile(java.net.URL fileUrl,
java.lang.String encoding)
Given the URl to a file in the specified encoding, returns a single string with the contents of that file. |
static java.lang.String |
readUnicodeStream(java.io.InputStream is,
java.lang.String encoding)
Reads an InputStream as a Unicode string in the specified encoding. |
static java.lang.String |
stripAngleBrackets(java.lang.String toStrip)
Removes leading and trailing angle brackets from a string. |
static void |
writeCollationRulesForLocale(java.util.Locale locale,
java.lang.String outFilePath)
Given a Java Locale object, constructs a RuleBasedCollator for the Locale, gets the collation rules, and writes them to a file. |
static void |
writeIcuCollationRulesForLocale(java.util.Locale locale,
java.lang.String outFilePath)
Given a Java Locale object, constructs a RuleBasedCollator for the Locale, gets the collation rules, and writes them to a file. |
static void |
writeUnicodeFile(java.lang.String outString,
java.lang.String filePath,
java.lang.String encoding)
Writes a string to a file in the specified encoding. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public I18nUtil()
| Method Detail |
public static java.lang.String stripAngleBrackets(java.lang.String toStrip)
toStrip - The string to be stripped.
public static byte[] hexToBytes(java.lang.String hexString)
hexString - A sequence of hex digit pairs.
public static java.lang.String echoStartTag(org.w3c.dom.Element elem)
elem - The element node to be echoed.
public static java.lang.String echoEndTag(org.w3c.dom.Element elem)
elem - The element node to be echoed.
public static org.w3c.dom.Element getAttHolder(org.w3c.dom.Element startNode,
java.lang.String attName)
throws I18nServiceError
startNode - The node to check first. It's ancestors will be interogated until
the attribute is found or the root is reached.attName - The name of the attribute to find.
I18nServiceErrorpublic static org.w3c.dom.Element getFirstElementChild(org.w3c.dom.Element elemNode)
elemNode - The element whose first element child is to be returned.public static boolean hasElementChildren(org.w3c.dom.Element elemNode)
elemNode - public static java.lang.String getElementContent(org.w3c.dom.Element elem)
elem - Element to get the value of.public static java.lang.String getElementContentNormalized(org.w3c.dom.Element elem)
elem - Element to get the value of.
public static java.lang.String getElementLanguage(org.w3c.dom.Element elemNode,
java.lang.String defaultLangCode)
elemNode - The whose language value is to be returned.defaultLangCode - The default language code to return if
there is no explicit language code.
public static org.w3c.dom.Element getElement(org.w3c.dom.Element parentElem,
java.lang.String tagName)
throws I18nUtilError
I18nUtilError
public static java.util.Locale getLocaleFromLangCode(java.lang.String langCode)
throws MissingLocaleException
langCode - The language and, optionally, country code for the desired locale.
MissingLocaleException. - Note that the set of available locales is a function of
how your Java installation is configured.
MissingLocaleExceptionpublic static int getIntForHexChar(char hexChar)
hexChar - The character to be processed, one of 0-9, A-F
public static java.lang.String escapeUnicodeString(java.lang.String inString)
inString - String to be processed.
public static java.lang.String byteToHex(byte b)
b - The byte to process.
public static java.lang.String charToHex(char c)
c - Character to process.
public static java.lang.String readUnicodeFile(java.net.URL fileUrl,
java.lang.String encoding)
throws I18nUtilError
fileUrl - The URL of the fileencoding - The encoding name: UTF8, UTF16, etc.
I18nUtilError
public static java.lang.String readUnicodeFile(java.lang.String filePath,
java.lang.String encoding)
throws I18nUtilError
filePath - Path to file to read.encoding - Encoding name (e.g. "UTF-16")
I18nUtilError
public static java.lang.String readUnicodeFile(java.io.File file,
java.lang.String encoding)
throws I18nUtilError
file - File to be read.encoding - Encoding name (e.g., "UTF-16")
I18nUtilError
public static java.lang.String readUnicodeStream(java.io.InputStream is,
java.lang.String encoding)
throws I18nUtilError
is - InputStream to be read.encoding - Encoding name (e.g., "UTF-16")
I18nUtilError
public static void writeUnicodeFile(java.lang.String outString,
java.lang.String filePath,
java.lang.String encoding)
throws I18nUtilError
outString - String to be written.filePath - Path of file to write to.encoding - Encoding name (e.g., "UTF-16")
I18nUtilError
public static void writeCollationRulesForLocale(java.util.Locale locale,
java.lang.String outFilePath)
throws I18nUtilError
locale - The Locale to get the rules for.outFilePath - File to write the rules to.
I18nUtilError
public static void writeIcuCollationRulesForLocale(java.util.Locale locale,
java.lang.String outFilePath)
throws I18nUtilError
locale - The Locale to get the rules for.outFilePath - File to write the rules to.
I18nUtilErrorpublic static java.lang.String getLangAttName()
public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||