Class TextLineFormatter

  • All Implemented Interfaces:
    OutputFormatter<java.lang.String>

    @MachineFormatter
    public class TextLineFormatter
    extends java.lang.Object
    implements OutputFormatter<java.lang.String>
    A simple text line formatter for given separators. Field names are ignored.
    Author:
    Holger Eichelberger, SSE
    • Constructor Detail

      • TextLineFormatter

        public TextLineFormatter​(java.lang.String charset,
                                 java.lang.String separator)
        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 Detail

      • add

        public void add​(java.lang.String name,
                        java.lang.String data)
                 throws java.io.IOException
        Description copied from interface: OutputFormatter
        Adds information to one chunk of output. Hierarchical names separated by OutputFormatter.SEPARATOR can be used, but nested values for the same parent (object) field must be named in sequence.
        Specified by:
        add in interface OutputFormatter<java.lang.String>
        Parameters:
        name - optional data name field (may be null for none)
        data - the data to be added
        Throws:
        java.io.IOException - if adding the data fails for some reason
      • chunkCompleted

        public byte[] chunkCompleted()
                              throws java.io.IOException
        Description copied from interface: OutputFormatter
        Completes a chunk of output data.
        Specified by:
        chunkCompleted in interface OutputFormatter<java.lang.String>
        Returns:
        the chunk
        Throws:
        java.io.IOException - if creating the chunk fails for some reason
      • endStructure

        public void endStructure()
                          throws java.io.IOException
        Description copied from interface: OutputFormatter
        Ends a structure started before.
        Specified by:
        endStructure in interface OutputFormatter<java.lang.String>
        Throws:
        java.io.IOException - if ending the actual structure fails