Class TemplateDoc

java.lang.Object
ch.software_atelier.simpleflex.docs.WebDoc
ch.software_atelier.simpleflex.docs.impl.TemplateDoc

public class TemplateDoc extends WebDoc
Author:
tk
  • Constructor Details

  • Method Details

    • add

      public void add(String placeholder, String value)
      Adds a placeholder and a refering value. Call the method replace() to replace all placeholders by the refering values.
      Parameters:
      placeholder -
      value -
    • replace

      public void replace()
      Calculates the document. It replaces all placeholders by the values.
    • clear

      public void clear()
    • size

      public long size()
      Description copied from class: WebDoc
      This method has to return the size of the Document in bytes.
      Specified by:
      size in class WebDoc
      Returns:
    • mime

      public String mime()
      Description copied from class: WebDoc
      This method has to return the MIME-Type of the Document. Example: text/plain. You can also use the static Method Utils.getMime(String ext) to get the MIME-Type of a File-Extension.
      Specified by:
      mime in class WebDoc
      Returns:
    • name

      public String name()
      Description copied from class: WebDoc
      This method has to return the FileName of the Document.
      Specified by:
      name in class WebDoc
      Returns:
    • byteData

      public byte[] byteData()
      Description copied from class: WebDoc
      If you want to return the documents data as a byte[], you have to do that here. Be sure, that the method dataType() returns WebDoc.DATA_BYTE! Else just return null or something else. If the method dataType() does not return WebDoc.DATA_BYTE, this method will never be called.
      Specified by:
      byteData in class WebDoc
      Returns:
    • streamData

      public InputStream streamData()
      Description copied from class: WebDoc
      If you want to return the documents data as a Stream, you have to do that here. Be sure, that the method dataType() returns WebDoc.DATA_STREAM! Else just return null or something else. If the method dataType() does not return WebDoc.DATA_STREAM, this method will never be called. The Stream will be closed by the Server-App so you have nothing to do with that.
      Specified by:
      streamData in class WebDoc
      Returns:
    • dataType

      public String dataType()
      Description copied from class: WebDoc
      Specifies the Type of served data. Look at streamData() and/or byteData()
      Specified by:
      dataType in class WebDoc
      Returns:
    • close

      public void close()
      Description copied from class: WebDoc
      This method is called after the transmission. It can be used to cleanup something.
      Specified by:
      close in class WebDoc