Class XmlWriter

java.lang.Object
org.rrd4j.core.XmlWriter
All Implemented Interfaces:
AutoCloseable

public class XmlWriter extends Object implements AutoCloseable
Extremely simple utility class used to create XML documents.
  • Field Details

  • Constructor Details

    • XmlWriter

      public XmlWriter(OutputStream stream)
      Creates XmlWriter with the specified output stream to send XML code to.
      Parameters:
      stream - Output stream which receives XML code
    • XmlWriter

      public XmlWriter(OutputStream stream, boolean autoFlush)
      Creates XmlWriter with the specified output stream to send XML code to.
      Parameters:
      stream - Output stream which receives XML code
      autoFlush - is the stream to be flushed automatically
  • Method Details

    • startTag

      public void startTag(String tag)
      Opens XML tag
      Parameters:
      tag - XML tag name
    • closeTag

      public void closeTag()
      Closes the corresponding XML tag
    • writeTag

      public void writeTag(String tag, Object value)
      Writes <tag>value</tag> to output stream
      Parameters:
      tag - XML tag name
      value - value to be placed between <tag> and </tag>
    • writeTag

      public void writeTag(String tag, int value)
      Writes <tag>value</tag> to output stream
      Parameters:
      tag - XML tag name
      value - value to be placed between <tag> and </tag>
    • writeTag

      public void writeTag(String tag, long value)
      Writes <tag>value</tag> to output stream
      Parameters:
      tag - XML tag name
      value - value to be placed between <tag> and </tag>
    • writeTag

      public void writeTag(String tag, double value, String nanString)
      Writes <tag>value</tag> to output stream
      Parameters:
      tag - XML tag name
      value - value to be placed between <tag> and </tag>
      nanString - a String object.
    • writeTag

      public void writeTag(String tag, double value)
      Writes <tag>value</tag> to output stream
      Parameters:
      tag - XML tag name
      value - value to be placed between <tag> and </tag>
    • writeTag

      public void writeTag(String tag, boolean value)
      Writes <tag>value</tag> to output stream
      Parameters:
      tag - XML tag name
      value - value to be placed between <tag> and </tag>
    • writeTag

      public void writeTag(String tag, Color value)
      Writes <tag>value</tag> to output stream
      Parameters:
      tag - XML tag name
      value - value to be placed between <tag> and </tag>
    • writeTag

      public void writeTag(String tag, Font value)
      Writes <tag>value</tag> to output stream
      Parameters:
      tag - XML tag name
      value - value to be placed between <tag> and </tag>
    • writeTag

      public void writeTag(String tag, File value)
      Writes <tag>value</tag> to output stream
      Parameters:
      tag - XML tag name
      value - value to be placed between <tag> and </tag>
    • flush

      public void flush()
      Flushes the output stream
    • writeComment

      public void writeComment(Object comment)
      Writes XML comment to output stream
      Parameters:
      comment - comment string
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable