Package net.cnri.util
Class Template
java.lang.Object
net.cnri.util.Template
Class used to merge complex data with a web page or other text document.
Can perform recursive iteration over specially formatted test.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intThis function returns the index of the next matching closed brace "}}".static StringsubDictIntoFile(File file, Map<?, ?> dict) Merge the hashtable data with the text from the specified filestatic StringsubDictIntoFile(String filename, Map<?, ?> dict) Merge the hashtable data with the text from the specified filestatic StringsubDictIntoStream(InputStream in, Map<?, ?> dict) static StringsubDictIntoString(String str, Map<?, ?> dict) Merge the hashtable data with the specified text
-
Constructor Details
-
Template
public Template()
-
-
Method Details
-
getMatchingBraceLocation
This function returns the index of the next matching closed brace "}}". It assumes that the start brace is *not* a part of the string. getMatchingBraceLocation("Hello{{xxx}} }}") will return 13. -
subDictIntoFile
public static String subDictIntoFile(String filename, Map<?, ?> dict) throws IOException, TemplateExceptionMerge the hashtable data with the text from the specified file- Throws:
IOExceptionTemplateException
-
subDictIntoFile
public static String subDictIntoFile(File file, Map<?, ?> dict) throws IOException, TemplateExceptionMerge the hashtable data with the text from the specified file- Throws:
IOExceptionTemplateException
-
subDictIntoStream
public static String subDictIntoStream(InputStream in, Map<?, ?> dict) throws IOException, TemplateException- Throws:
IOExceptionTemplateException
-
subDictIntoString
Merge the hashtable data with the specified text- Throws:
TemplateException
-