Class TextLineFormatter
java.lang.Object
de.iip_ecosphere.platform.connectors.formatter.TextLineFormatter
- All Implemented Interfaces:
OutputFormatter<String>
A simple text line formatter for given separators. Field names are ignored.
- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classOwn parser converter type to hide implementing class for future modifications.Nested classes/interfaces inherited from interface de.iip_ecosphere.platform.connectors.formatter.OutputFormatter
OutputFormatter.OutputConverter<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringstatic final TextLineFormatter.TextLineFormatterConverterprivate Stringprivate StringBuilderFields inherited from interface de.iip_ecosphere.platform.connectors.formatter.OutputFormatter
SEPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionTextLineFormatter(String charset, String separator) Creates a new text line formatter. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds information to one chunk of output.byte[]Completes a chunk of output data.voidEnds a structure started before.Returns the output converter.voidstartArrayStructure(String name) Starts an array structure.voidstartObjectStructure(String name) Starts an object structure.
-
Field Details
-
CONVERTER
-
charset
-
separator
-
tmp
-
-
Constructor Details
-
TextLineFormatter
Creates a new text line formatter.- Parameters:
charset- the charset of the text encoding (preliminary as string)separator- the separator to be used between data fields
-
-
Method Details
-
add
Description copied from interface:OutputFormatterAdds information to one chunk of output. Hierarchical names separated byOutputFormatter.SEPARATORcan be used, but nested values for the same parent (object) field must be named in sequence.- Specified by:
addin interfaceOutputFormatter<String>- Parameters:
name- optional data name field (may be null for none)data- the data to be added- Throws:
IOException- if adding the data fails for some reason
-
chunkCompleted
Description copied from interface:OutputFormatterCompletes a chunk of output data.- Specified by:
chunkCompletedin interfaceOutputFormatter<String>- Returns:
- the chunk
- Throws:
IOException- if creating the chunk fails for some reason
-
getConverter
Description copied from interface:OutputFormatterReturns the output converter.- Specified by:
getConverterin interfaceOutputFormatter<String>- Returns:
- the output converter
-
startArrayStructure
Description copied from interface:OutputFormatterStarts an array structure. FollowingOutputFormatter.add(String, Object)calls will add elements to the array. Must be closed withOutputFormatter.endStructure()- Specified by:
startArrayStructurein interfaceOutputFormatter<String>- Parameters:
name- optional data name field holding the array (may be null for none)- Throws:
IOException- if starting this structure fails
-
startObjectStructure
Description copied from interface:OutputFormatterStarts an object structure. FollowingOutputFormatter.add(String, Object)calls will add elements to the object. Must be closed withOutputFormatter.endStructure()- Specified by:
startObjectStructurein interfaceOutputFormatter<String>- Parameters:
name- optional data name field holding the array (may be null for none)- Throws:
IOException- if starting this structure fails
-
endStructure
Description copied from interface:OutputFormatterEnds a structure started before.- Specified by:
endStructurein interfaceOutputFormatter<String>- Throws:
IOException- if ending the actual structure fails
-