Class TextFileWithLineNumbersWriter

  • All Implemented Interfaces:
    Destroyable, GlobalInfoSupporter, EncodingSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, SizeOfHandler, Serializable

    public class TextFileWithLineNumbersWriter
    extends TextFileWriter
    Writes the content to a text file, preceding each line with its line number.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
    -enabled <boolean> (property: enabled)
        Whether the writer is enabled.
        default: true
    -encoding <adams.core.base.BaseCharset> (property: encoding)
        The type of encoding to use.
        default: Default
    -filename-generator <> (property: filenameGenerator)
        The filename generator to use.
    -ignore-name <boolean> (property: ignoreName)
        If set to true, then the name of the content is ignored for generating the 
        filename (useful when prefix or suffix is based on variables).
        default: false
    -append <boolean> (property: append)
        If enabled, the content gets appended rather than rewriting the file.
        default: false
    -separator <java.lang.String> (property: separator)
        The separator between line number and line content.
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Separator

        protected String m_Separator
        the separator between the line number and the actual line.
      • m_Count

        protected int m_Count
        the line count.
    • Constructor Detail

      • TextFileWithLineNumbersWriter

        public TextFileWithLineNumbersWriter()
    • Method Detail

      • setSeparator

        public void setSeparator​(String value)
        Sets the separator between line number and line content.
        value - the separator
      • getSeparator

        public String getSeparator()
        Returns the separator between line number and line content.
        the separator
      • separatorTipText

        public String separatorTipText()
        Returns the tip text for this property.
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • doWrite

        protected String doWrite​(String content,
                                 String name)
        Writes the given content under the specified name.
        doWrite in class TextFileWriter
        content - the content to write
        name - the name under which to save the content
        if a file was generated, the filename the content was written as, otherwise null