Class OutputStreamXMLOutput

java.lang.Object
edu.umd.cs.findbugs.xml.OutputStreamXMLOutput
All Implemented Interfaces:
XMLOutput

public class OutputStreamXMLOutput extends Object implements XMLOutput
Write XML to an output stream.
Author:
David Hovemeyer
  • Constructor Details

    • OutputStreamXMLOutput

      public OutputStreamXMLOutput(@WillCloseWhenClosed OutputStream os)
      Constructor.
      Parameters:
      os - OutputStream to write XML output to
    • OutputStreamXMLOutput

      public OutputStreamXMLOutput(@WillCloseWhenClosed Writer writer)
      Constructor.
      Parameters:
      writer - Writer to write XML output to
    • OutputStreamXMLOutput

      public OutputStreamXMLOutput(@WillCloseWhenClosed OutputStream os, String stylesheet)
      Constructor.
      Parameters:
      os - OutputStream to write XML output to
      stylesheet - name of stylesheet
    • OutputStreamXMLOutput

      public OutputStreamXMLOutput(@WillCloseWhenClosed Writer writer, String stylesheet)
  • Method Details

    • beginDocument

      public void beginDocument() throws IOException
      Description copied from interface: XMLOutput
      Begin the XML document.
      Specified by:
      beginDocument in interface XMLOutput
      Throws:
      IOException
    • openTag

      public void openTag(String tagName) throws IOException
      Description copied from interface: XMLOutput
      Open a tag with given name.
      Specified by:
      openTag in interface XMLOutput
      Parameters:
      tagName - the tag name
      Throws:
      IOException
    • openTag

      public void openTag(String tagName, XMLAttributeList attributeList) throws IOException
      Description copied from interface: XMLOutput
      Open a tag with given name and given attributes.
      Specified by:
      openTag in interface XMLOutput
      Parameters:
      tagName - the tag name
      attributeList - the attributes
      Throws:
      IOException
    • openCloseTag

      public void openCloseTag(String tagName) throws IOException
      Description copied from interface: XMLOutput
      Open and close tag with given name.
      Specified by:
      openCloseTag in interface XMLOutput
      Parameters:
      tagName - the tag name
      Throws:
      IOException
    • openCloseTag

      public void openCloseTag(String tagName, XMLAttributeList attributeList) throws IOException
      Description copied from interface: XMLOutput
      Open and close tag with given name and given attributes.
      Specified by:
      openCloseTag in interface XMLOutput
      Parameters:
      tagName - the tag name
      attributeList - the attributes
      Throws:
      IOException
    • startTag

      public void startTag(String tagName) throws IOException
      Description copied from interface: XMLOutput
      Start a tag, with the intention of adding attributes. Must be followed by stopTag after zero or more addAttribute calls.
      Specified by:
      startTag in interface XMLOutput
      Parameters:
      tagName - the tag name
      Throws:
      IOException
    • addAttribute

      public void addAttribute(String name, String value) throws IOException
      Description copied from interface: XMLOutput
      Add an attribute to a started tag. Must follow a call to startTag.
      Specified by:
      addAttribute in interface XMLOutput
      Parameters:
      name - the attribute name.
      value - the attribute value, unescaped.
      Throws:
      IOException
    • stopTag

      public void stopTag(boolean close) throws IOException
      Description copied from interface: XMLOutput
      End a started tag. Must follow a call to startTag.
      Specified by:
      stopTag in interface XMLOutput
      Parameters:
      close - true if the element has no content.
      Throws:
      IOException
    • closeTag

      public void closeTag(String tagName) throws IOException
      Description copied from interface: XMLOutput
      Close tag with given name.
      Specified by:
      closeTag in interface XMLOutput
      Parameters:
      tagName - the tag name
      Throws:
      IOException
    • writeText

      public void writeText(String text) throws IOException
      Description copied from interface: XMLOutput
      Write text to the XML document. XML metacharacters are automatically escaped.
      Specified by:
      writeText in interface XMLOutput
      Parameters:
      text - the text to write
      Throws:
      IOException
    • writeCDATA

      public void writeCDATA(String cdata) throws IOException
      Description copied from interface: XMLOutput
      Write a CDATA section to the XML document. The characters are not escaped in any way.
      Specified by:
      writeCDATA in interface XMLOutput
      Parameters:
      cdata - the character data to write
      Throws:
      IOException
    • flush

      public void flush() throws IOException
      Throws:
      IOException
    • finish

      @DischargesObligation public void finish() throws IOException
      Description copied from interface: XMLOutput
      Finish writing XML output, closing any underlying resources (such as output streams). A call to this method should always be made, even if one of the XML-generation methods throws an exception. Therefore, a call to this method should be performed in a finally block.
      Specified by:
      finish in interface XMLOutput
      Throws:
      IOException