Interface TemplateManager


  • public interface TemplateManager
    TemplateManager which will merge the template and values together.
    Since:
    2018-10-01
    Version:
    1.0.0
    Author:
    Abhishek Kumar
    • Method Detail

      • merge

        InputStream merge​(InputStream template,
                          Map<String,​Object> values)
                   throws IOException
        Method to merge template , where template content will be pass as inputSteam
        Parameters:
        template - the InputStream is template content .
        values - as Map<String,Object > where key will be placeholder name and Object is the actual value for the placeholder
        Returns:
        template merged template content as InputStream
        Throws:
        IOException - if an I/O exception occurs during writing to the writer
      • merge

        boolean merge​(String templateName,
                      Writer writer,
                      Map<String,​Object> values)
               throws IOException
        Merges a template and puts the rendered stream into the writer. The default encoding that template manager uses to read template files is UTF-8
        Parameters:
        templateName - name of template to be used in merge
        writer - output writer for rendered template
        values - as Map<String,Object > where key is placeholder name and Object is Placeholder value
        Returns:
        boolean true if successfully, false otherwise.
        Throws:
        IOException - if an I/O exception occurs during writing to the writer
      • merge

        boolean merge​(String templateName,
                      Writer writer,
                      Map<String,​Object> values,
                      String encodingType)
               throws IOException
        Method to merge template using provided encoding type
        Parameters:
        templateName - name of the template to be used in merge
        writer - output writer for render template
        values - as Map<String,Object > where key is placeholder name and Object is value for the placeholder
        encodingType - as String like UTF-8,UTF-16 etc.
        Returns:
        boolean true if successfully, false otherwise
        Throws:
        IOException - if an I/O exception occurs during writing to the writer