|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.g11ntoolkit.strfile.StrFile
|
+--com.g11ntoolkit.strfile.JSStrFile
Creates and maintains a string file with its associated buffer and hashtable.
This class extends the StrFile class because there are some speicial tags used in the StrFile for extracted JavaScript code.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
See License Agreement.
| Field Summary | |
private java.lang.String |
inputFileName
The name of the input file. |
private static java.util.logging.Logger |
log
The log used for all messages from this class. |
| Fields inherited from class com.g11ntoolkit.strfile.StrFile |
contextFileName, datatype, elementTable, mrb, productName, productVersion, sourceFileName, stringTable, targetLocale, theBuffer, thisLocale, tokFile, vrb, xliffrb, xrb |
| Constructor Summary | |
JSStrFile()
Creates and an empty hashtable. |
|
JSStrFile(java.util.Locale aLocale)
Creates an empty hashtable. |
|
| Method Summary | |
void |
append(Token aToken,
JSXLEntry aBlock)
Adds the specified token and string translation entry to the hashtable. |
void |
copyOf(JSStrFile anotherJSStrFile)
Creates a copy of the contents of another JSStrFile object in this object. |
void |
debugDump(java.lang.String what)
Dumps the contents of the object to the console for debugging. |
boolean |
findBlock(JSXLEntry aBlock)
Returns true if the specified string translation entry is in the file. |
java.lang.String |
getFileName()
Returns the name of the input file. |
JSXLEntry |
getJSString(Token aToken)
Returns the string translation entry for the specified token. |
boolean |
hasEntries()
Returns boolean. |
void |
load(java.util.Locale locale,
java.lang.String xmlFileName)
Loads the string buffer and the hashtable with the records read from either the specified input stream reader or the specified XML file. |
void |
writeFlatXML(java.io.OutputStreamWriter osWriter,
boolean writeBOM)
Writes the string file out to the specified output stream writer in a flat XML form sorted by Token id. |
void |
writeXLIFF(java.io.OutputStreamWriter osWriter,
boolean writeBOM,
boolean sourceonly)
Writes the string file out to the specified output stream writer in XLIFF form. |
| Methods inherited from class com.g11ntoolkit.strfile.StrFile |
append, append, convertToFileURL, copyOf, debugDump, findString, findToken, getBuffer, getContextFileName, getDatatype, getElementTable, getLocale, getProductName, getProductVersion, getSourceFileName, getString, getString, getStringTable, getTargetLocale, getTokFile, getXLIFFLocaleString, keys, loadXLIFF, setContextFileName, setDatatype, setLocale, setProductName, setProductVersion, setSourceFileName, setTargetLocale, setTokFile |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static java.util.logging.Logger log
private java.lang.String inputFileName
| Constructor Detail |
public JSStrFile()
This may be handy if the buffer is going to be used to create a new string file.
public JSStrFile(java.util.Locale aLocale)
aLocale - a Locale specifying the locale for this object| Method Detail |
public void copyOf(JSStrFile anotherJSStrFile)
JSStrFile object in this object.
anotherJSStrFile - a JSStrFile specifying the JSStrFile object to copypublic boolean hasEntries()
public void load(java.util.Locale locale,
java.lang.String xmlFileName)
throws StrFileError
The string buffer will contain the file level information for the file. This usually is nothing but comments. The hashtable will contain the token and string entries for each string in the file. The specified locale will be used for each string entry. It is assumed that the locale is correct and no further checking is done.
The rules for an XML file are contained in the XML Parser used to read the file.
The rules are pretty straight forward.
locale - a Locale object or null if xmlfile is truexmlFileName - a String specifying the name of the XML file or null if xmlfile is false
StrFileError - if there is an error when processing the file
public void writeFlatXML(java.io.OutputStreamWriter osWriter,
boolean writeBOM)
throws EmptyStrFile,
java.io.IOException
Token id.
This method handles the different tags used in a JSStrFile.
osWriter - an OutputStreamWriter objectwriteBOM - a boolean indicating whether to write a Byte Order Mark (true) or not (false)
EmptyStrFile - if there is nothing to write out
java.io.IOException - if any error is detected for the output writer
public void writeXLIFF(java.io.OutputStreamWriter osWriter,
boolean writeBOM,
boolean sourceonly)
throws EmptyStrFile,
java.io.IOException
writeXLIFF in class StrFileosWriter - an OutputStreamWriter objectwriteBOM - a boolean indicating whether to write a Byte Order Mark (true) or not (false)sourceonly - a boolean indicating whether to write a source only file (true) or a source and target file (false)
EmptyStrFile - if there is nothing to write out
java.io.IOException - if any error is detected for the output writerpublic JSXLEntry getJSString(Token aToken)
aToken - a Token object specifying the key of the desired entry
public boolean findBlock(JSXLEntry aBlock)
public java.lang.String getFileName()
public void append(Token aToken,
JSXLEntry aBlock)
aToken - a Token objectpublic void debugDump(java.lang.String what)
You can control what gets dumped by specifying a parameter. The parameter can be ALL, BUFFER, or STRINGS. The parameter must be specified in all uppercase characters.
debugDump in class StrFilewhat - a String specifying what to dump
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||