Class XmlWriter

java.lang.Object
net.luis.utils.io.data.xml.XmlWriter
All Implemented Interfaces:
AutoCloseable

public class XmlWriter extends Object implements AutoCloseable
A xml writer for writing xml elements to an output.
The writer expects only one xml element per output.
  • Field Details

    • config

      private final XmlConfig config
      The xml config used by the writer.
    • writer

      private final BufferedWriter writer
      The internal writer used to write the xml elements.
    • wroteDeclaration

      private boolean wroteDeclaration
      A flag indicating whether the xml declaration was already written.
  • Constructor Details

    • XmlWriter

      public XmlWriter(@NotNull @NotNull OutputProvider output)
      Constructs a new xml writer with the default configuration.
      Parameters:
      output - The output to create the writer for
      Throws:
      NullPointerException - If the output is null
    • XmlWriter

      public XmlWriter(@NotNull @NotNull OutputProvider output, @NotNull @NotNull XmlConfig config)
      Constructs a new xml writer with the given configuration.
      Parameters:
      output - The output to create the writer for
      config - The configuration to use for the writer
      Throws:
      NullPointerException - If the output or the configuration is null
  • Method Details