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 int
This function returns the index of the next matching closed brace "}}".static String
subDictIntoFile
(File file, Map<?, ?> dict) Merge the hashtable data with the text from the specified filestatic String
subDictIntoFile
(String filename, Map<?, ?> dict) Merge the hashtable data with the text from the specified filestatic String
subDictIntoStream
(InputStream in, Map<?, ?> dict) static String
subDictIntoString
(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:
IOException
TemplateException
-
subDictIntoFile
public static String subDictIntoFile(File file, Map<?, ?> dict) throws IOException, TemplateExceptionMerge the hashtable data with the text from the specified file- Throws:
IOException
TemplateException
-
subDictIntoStream
public static String subDictIntoStream(InputStream in, Map<?, ?> dict) throws IOException, TemplateException- Throws:
IOException
TemplateException
-
subDictIntoString
Merge the hashtable data with the specified text- Throws:
TemplateException
-