Class SimpleXmlWriter

java.lang.Object
com.compomics.util.io.export.xml.SimpleXmlWriter
All Implemented Interfaces:
AutoCloseable

public class SimpleXmlWriter
extends Object
implements AutoCloseable
Simple writer for xml files.
Author:
Marc Vaudel
  • Field Details

    • indentCounter

      protected int indentCounter
      Integer keeping track of the number of indents to include at the beginning of each line.
  • Constructor Details

  • Method Details

    • getIndentString

      public String getIndentString()
      Returns the indent string to use, e.g. tab or space.
      Returns:
      the indent string to use
    • setIndentString

      public void setIndentString​(String indentString)
      Sets the indent string to use, e.g. tab or space.
      Parameters:
      indentString - the indent string to use
    • writeIndent

      public void writeIndent() throws IOException
      Writes the current indent.
      Throws:
      IOException - exception thrown whenever an error occurs while writing
    • write

      public void write​(String content) throws IOException
      Writes the content to the file.
      Parameters:
      content - the content as String
      Throws:
      IOException - exception thrown whenever an error occurs while writing
    • writeLine

      public void writeLine​(String line) throws IOException
      Writes the given line.
      Parameters:
      line - the line to write
      Throws:
      IOException - exception thrown whenever an error occurs while writing
    • writeLineIncreasedIndent

      public void writeLineIncreasedIndent​(String line) throws IOException
      Writes the given line with an increased indent.
      Parameters:
      line - the line to write
      Throws:
      IOException - exception thrown whenever an error occurs while writing
    • writeLineDecreasedIndent

      public void writeLineDecreasedIndent​(String line) throws IOException
      Writes the given line with a decreased indent.
      Parameters:
      line - the line to write
      Throws:
      IOException - exception thrown whenever an error occurs while writing
    • newLine

      public void newLine() throws IOException
      Adds an end of line character.
      Throws:
      IOException - exception thrown whenever an error occurs while writing
    • increaseIndent

      public void increaseIndent()
      Increases the indent counter.
    • decreaseIndent

      public void decreaseIndent()
      Decreases the indent counter.
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException