|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.wm.util.coder.Coder
com.wm.util.template.Reporter
public class Reporter
Extends the Coder class. This class contains the methods you use to apply an output template to a specified Codable object. An output template is a character string made up of literal text and one or more tags. A tag is an instruction that causes a prescribed substitution to be performed at run time. If a tag references a variable, that variable is pulled from the Codable object to which you are applying the output template.
For a complete list of tags that the Reporter class recognizes, see the DSPs & Output Templates Developer's Guide.
Coder
,
Codable
Constructor Summary | |
---|---|
Reporter(java.lang.String stringTemplate)
Constructs a Reporter object using the output template in the specified String. |
|
Reporter(java.lang.String templateFile,
java.io.File templateDir)
Constructs a Reporter object using the output template in the specified file. |
|
Reporter(java.lang.String templateFile,
java.io.File templateDir,
Codable input)
Deprecated. replaced by Reporter(String, File) |
|
Reporter(java.lang.String templateFile,
java.io.File templateDir,
Codable input,
boolean tryCache)
Deprecated. No replacement. |
|
Reporter(java.lang.String templateFile,
java.io.File templateDir,
Codable input,
boolean tryCache,
java.lang.String encoding)
Deprecated. No replacement. |
|
Reporter(java.lang.String templateFile,
java.lang.String templateDir,
Codable input)
Deprecated. replaced by Reporter(String, File) |
Method Summary | |
---|---|
static TemplateToken |
createTemplateFromFile(java.io.File tmplFile,
java.lang.String fileEncoding)
Returns a TemplateToken object from the output template in the specified file. |
static TemplateToken |
createTemplateFromString(java.lang.String tmplString,
long modTime)
Returns a TemplateToken object from the output template in the specified String. |
void |
encode(java.io.OutputStream os,
Values val)
Encodes a Values object to the specified OutputStream using the format specified by this Reporter object (i.e., the format specified by the template file.) |
java.lang.String |
getContentType()
Returns a String indicating the content-type supported by this Reporter object (e.g., "text/html"). |
byte[] |
report()
Deprecated. replaced by report(Codable) |
byte[] |
report(Codable input)
Applies the output template to the specified Codable object and returns a byte array containing the result of this process. |
void |
reportToFile(Codable input,
java.io.File target)
Applies the output template to the specified Codable object and writes the results to the specified File. |
void |
reportToOutput(Codable input,
java.io.OutputStream os)
Applies the output template to the specified Codable object and writes the results to the specified OutputStream. |
void |
setContentType(java.lang.String cType)
Sets the content type supported by this Reporter object. |
Methods inherited from class com.wm.util.coder.Coder |
---|
decode, decodeFromBytes, encodeToBytes, readFromFile, readFully, writeToFile |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Reporter(java.lang.String templateFile, java.io.File templateDir) throws java.io.FileNotFoundException
Note: When you use this constructor, you use the report(Codable) method to apply the template to your Codable object.
templateFile
- A String specifying the name of the file containing the
output template that you want this Reporter object to use. Specify only the
file name portion of the file in this parameter. At run time, the Reporter will
look for this file in the path specified in templateDirtemplateDir
- A File object that specifies the directory in which the
output template file resides.
java.io.FileNotFoundException
- If the specified template file does not exist.report(Codable)
public Reporter(java.lang.String stringTemplate)
Note: When you use this constructor, you use the report(Codable) method to apply the output template to your Codable object.
stringTemplate
- A String containing the output template that you want
this Reporter object to use.report(Codable)
public Reporter(java.lang.String templateFile, java.lang.String templateDir, Codable input) throws java.io.FileNotFoundException
Reporter(String, File)
templateFile
- A String specifying the name of the file containing the
output template that you want this Reporter object to use. Specify only the
file name portion of the file in this parameter. At run time, the Reporter will
look for this file in the path specified in templateDir.templateDir
- A String that specifies the directory in which the output
template file resides.input
- The Codable object (for example, the Values or
IData object) to which you want the output template applied.
java.io.FileNotFoundException
- If the specified template file does not exist.public Reporter(java.lang.String templateFile, java.io.File templateDir, Codable input) throws java.io.FileNotFoundException
Reporter(String, File)
templateFile
- A String specifying the name of the file containing the
output template that you want this Reporter object to use. Specify only the
file name portion of the file in this parameter. At run time, the Reporter will
look for this file in the path specified in templateDir.templateDir
- A File object specifying the directory in which the output
template file resides.input
- The Codable object (for example, the Values or
IData object) to which you want the output template applied.
java.io.FileNotFoundException
- If the specified template file does not exist.public Reporter(java.lang.String templateFile, java.io.File templateDir, Codable input, boolean tryCache) throws java.io.FileNotFoundException
Note: If the template file is Unicode, the output encoding will be in Unicode.
templateFile
- A String specifying the name of the file containing the
output template that you want this Reporter object to use. Specify only the
file name portion of the file in this parameter. At run time, the Reporter will
look for this file in the path specified in templateDir.templateDir
- A File object specifying the directory in which the output
template file resides.input
- The Codable object (for example, the Values or
IData object) to which you want the template applied.tryCache
- A boolean specifying whether you want this Reporter
object to use cache. If you set tryCache to true, this
Reporter object will check cache before attempting to retrieve the output
template from a file. If the output template already resides in cache, it uses that
template. If the output template does not reside in cache, it fetches that template from
the specified file and caches it.
java.io.FileNotFoundException
- If the specified template file does not exist.public Reporter(java.lang.String templateFile, java.io.File templateDir, Codable input, boolean tryCache, java.lang.String encoding) throws java.io.FileNotFoundException
templateFile
- A String specifying the name of the file containing the
output template that you want this Reporter object to use. Specify only the
file name portion of the file in this parameter. At run time, the Reporter will
look for this file in the path specified in templateDir.templateDir
- A File object specifying the directory in which the output
template file resides.input
- The Codable object (for example, the Values or
IData object) to which you want the output template applied.tryCache
- A boolean specifying whether you want this Reporter
object to use cache. If you set tryCache to true, this
Reporter object will check cache before attempting to retrieve the output
template from a file. If the template already resides in cache, it uses that template.
If the template does not reside in cache, it fetches that template from the specified
file and caches it.encoding
- A String specifying the format that you want this
Reporter object to encode the output it generates. A Java or IANA encoding name
may be specified. If this parameter is null and the template file is Unicode, then the
output will be in Unicode.
java.io.FileNotFoundException
- If the specified template file does not exist.Method Detail |
---|
public static TemplateToken createTemplateFromString(java.lang.String tmplString, long modTime)
tmplString
- The String containing the output template that you want to
parse.modTime
- A long value specifying the value of the date stamp that will be
inserted when the $lastmod system variable is referenced within the output
template. If $lastmod is not used, you can set this to 0.
public static TemplateToken createTemplateFromFile(java.io.File tmplFile, java.lang.String fileEncoding) throws java.io.FileNotFoundException
tmplFile
- A File object specifying the file in which the output template
resides.fileEncoding
- A String specifying the IANA format of the output template
file.
java.io.FileNotFoundException
- If specified template file does not exist.public byte[] report()
report(Codable)
Note: All constructors that use a Codable object as input have been deprecated.
public byte[] report(Codable input)
input
- The Codable object to which you want the output template applied.
reportToFile(Codable, File)
,
reportToOutput(Codable, OutputStream)
public void reportToFile(Codable input, java.io.File target) throws java.io.IOException
input
- The Codable object to which you want the output template applied.target
- A File specifying the file to which the results are to be
written.
java.io.IOException
- If the results cannot be written to the specified file.report(Codable)
,
reportToOutput(Codable, OutputStream)
public void reportToOutput(Codable input, java.io.OutputStream os) throws java.io.IOException
input
- The Codable object to which you want the output template applied.os
- The OutputStream to which you want the results written.
java.io.IOException
- If the results cannot be written to the specified
OutputStream.report(Codable)
,
reportToFile(Codable, File)
public void encode(java.io.OutputStream os, Values val) throws java.io.IOException
encode
in class Coder
os
- The OutputStream to which you want the encoded Values
written. object.val
- The Values object that you want to encode.
java.io.IOException
- If an error occurs while writing the OutputStream.Coder.encodeToBytes(com.wm.util.Values)
,
Coder.writeToFile(java.io.File, com.wm.util.Values)
public java.lang.String getContentType()
getContentType
in class Coder
public void setContentType(java.lang.String cType)
cType
- A String specifying the content type supported by this
Reporter object.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |