S - source object type for object generationpublic abstract class CharacterGenerator<S> extends 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(OutputStream contentStream,
OutputProperties outProps,
S s)
Generates content to the output stream based upon the provided
request/response.
|
abstract void |
generate(Writer contentWriter,
OutputProperties outProps,
S s)
Generates character content to the specified writer.
|
protected static String |
getCharsetEncoding(OutputProperties outProps)
Returns the character set encoding that should be used for generated
output.
|
protected Writer |
getContentWriter(OutputProperties outProps,
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, waitgetAltFormat, getSourceTypeprotected static String getCharsetEncoding(OutputProperties outProps)
outProps - output properties for generated outputprotected Writer getContentWriter(OutputProperties outProps, OutputStream contentStream) throws IOException
Writer that is properly configured to generate output
based upon the request and response attributes.outProps - output properties for the generated output.contentStream - IOExceptionpublic void generate(OutputStream contentStream, OutputProperties outProps, S s) throws IOException
OutputGeneratorgenerate in interface OutputGenerator<S>contentStream - the target stream for content generation.outProps - output properties for the generated outputs - source object for output generationIOExceptionpublic abstract void generate(Writer contentWriter, OutputProperties outProps, S s) throws IOException
contentWriter - output writer.outProps - output properties for the generated output.s - source object for the generated output.IOExceptionprotected 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.Copyright © 2012. All Rights Reserved.