S
- source object type for object generationpublic abstract class CharacterGenerator<S> extends java.lang.Object implements OutputGenerator<S>
OutputGenerator
types. It provides common logic
for determining the appropriate character set encoding based upon output
properties and will provide a bridge between output streams and writers.Constructor and Description |
---|
CharacterGenerator() |
Modifier and Type | Method and Description |
---|---|
void |
generate(java.io.OutputStream contentStream,
OutputProperties outProps,
S s)
Generates content to the output stream based upon the provided
request/response.
|
abstract void |
generate(java.io.Writer contentWriter,
OutputProperties outProps,
S s)
Generates character content to the specified writer.
|
protected static java.lang.String |
getCharsetEncoding(OutputProperties outProps)
Returns the character set encoding that should be used for generated
output.
|
protected java.io.Writer |
getContentWriter(OutputProperties outProps,
java.io.OutputStream contentStream)
Returns a
Writer that is properly configured to generate output
based upon the request and response attributes. |
protected boolean |
usePrettyPrint(OutputProperties outProps)
Returns
true if the output should use a pretty printed format on
output. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAltFormat, getSourceType
protected static java.lang.String getCharsetEncoding(OutputProperties outProps)
outProps
- output properties for generated outputprotected java.io.Writer getContentWriter(OutputProperties outProps, java.io.OutputStream contentStream) throws java.io.IOException
Writer
that is properly configured to generate output
based upon the request and response attributes.outProps
- output properties for the generated output.contentStream
- java.io.IOException
public void generate(java.io.OutputStream contentStream, OutputProperties outProps, S s) throws java.io.IOException
OutputGenerator
generate
in interface OutputGenerator<S>
contentStream
- the target stream for content generation.outProps
- output properties for the generated outputs
- source object for output generationjava.io.IOException
public abstract void generate(java.io.Writer contentWriter, OutputProperties outProps, S s) throws java.io.IOException
contentWriter
- output writer.outProps
- output properties for the generated output.s
- source object for the generated output.java.io.IOException
protected boolean usePrettyPrint(OutputProperties outProps)
true
if the output should use a pretty printed format on
output. The default implementation will pretty print output if the
GDataProtocol.Parameter#PRETTYPRINT
parameter has a value of
"true".outProps
- output properties for the generated output.true
if the output should be formatted.