Package edu.umd.cs.findbugs.xml
Class OutputStreamXMLOutput
- java.lang.Object
-
- edu.umd.cs.findbugs.xml.OutputStreamXMLOutput
-
-
Field Summary
Fields Modifier and Type Field Description private intnestingLevelprivate booleannewLineprivate static java.lang.StringOPENINGprivate java.io.Writeroutprivate java.lang.Stringstylesheet
-
Constructor Summary
Constructors Constructor Description OutputStreamXMLOutput(java.io.OutputStream os)Constructor.OutputStreamXMLOutput(java.io.OutputStream os, java.lang.String stylesheet)Constructor.OutputStreamXMLOutput(java.io.Writer writer)Constructor.OutputStreamXMLOutput(java.io.Writer writer, java.lang.String stylesheet)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(java.lang.String name, java.lang.String value)Add an attribute to a started tag.voidbeginDocument()Begin the XML document.voidcloseTag(java.lang.String tagName)Close tag with given name.private voidemitTag(java.lang.String tagName, boolean close)private voidemitTag(java.lang.String tagName, java.lang.String attributes, boolean close)voidfinish()Finish writing XML output, closing any underlying resources (such as output streams).voidflush()private static java.lang.StringgetStylesheetCode(java.lang.String stylesheet)private voidindent()voidopenCloseTag(java.lang.String tagName)Open and close tag with given name.voidopenCloseTag(java.lang.String tagName, XMLAttributeList attributeList)Open and close tag with given name and given attributes.voidopenTag(java.lang.String tagName)Open a tag with given name.voidopenTag(java.lang.String tagName, XMLAttributeList attributeList)Open a tag with given name and given attributes.voidstartTag(java.lang.String tagName)Start a tag, with the intention of adding attributes.voidstopTag(boolean close)End a started tag.voidwriteCDATA(java.lang.String cdata)Write a CDATA section to the XML document.voidwriteText(java.lang.String text)Write text to the XML document.
-
-
-
Field Detail
-
OPENING
private static final java.lang.String OPENING
- See Also:
- Constant Field Values
-
out
private final java.io.Writer out
-
nestingLevel
private int nestingLevel
-
newLine
private boolean newLine
-
stylesheet
private final java.lang.String stylesheet
-
-
Constructor Detail
-
OutputStreamXMLOutput
public OutputStreamXMLOutput(@WillCloseWhenClosed java.io.OutputStream os)Constructor.- Parameters:
os- OutputStream to write XML output to
-
OutputStreamXMLOutput
public OutputStreamXMLOutput(@WillCloseWhenClosed java.io.Writer writer)Constructor.- Parameters:
writer- Writer to write XML output to
-
OutputStreamXMLOutput
public OutputStreamXMLOutput(@WillCloseWhenClosed java.io.OutputStream os, java.lang.String stylesheet)Constructor.- Parameters:
os- OutputStream to write XML output tostylesheet- name of stylesheet
-
OutputStreamXMLOutput
public OutputStreamXMLOutput(@WillCloseWhenClosed java.io.Writer writer, java.lang.String stylesheet)
-
-
Method Detail
-
getStylesheetCode
private static java.lang.String getStylesheetCode(java.lang.String stylesheet)
-
beginDocument
public void beginDocument() throws java.io.IOExceptionDescription copied from interface:XMLOutputBegin the XML document.- Specified by:
beginDocumentin interfaceXMLOutput- Throws:
java.io.IOException
-
openTag
public void openTag(java.lang.String tagName) throws java.io.IOExceptionDescription copied from interface:XMLOutputOpen a tag with given name.
-
openTag
public void openTag(java.lang.String tagName, XMLAttributeList attributeList) throws java.io.IOExceptionDescription copied from interface:XMLOutputOpen a tag with given name and given attributes.
-
openCloseTag
public void openCloseTag(java.lang.String tagName) throws java.io.IOExceptionDescription copied from interface:XMLOutputOpen and close tag with given name.- Specified by:
openCloseTagin interfaceXMLOutput- Parameters:
tagName- the tag name- Throws:
java.io.IOException
-
openCloseTag
public void openCloseTag(java.lang.String tagName, XMLAttributeList attributeList) throws java.io.IOExceptionDescription copied from interface:XMLOutputOpen and close tag with given name and given attributes.- Specified by:
openCloseTagin interfaceXMLOutput- Parameters:
tagName- the tag nameattributeList- the attributes- Throws:
java.io.IOException
-
startTag
public void startTag(java.lang.String tagName) throws java.io.IOExceptionDescription copied from interface:XMLOutputStart a tag, with the intention of adding attributes. Must be followed by stopTag after zero or more addAttribute calls.
-
addAttribute
public void addAttribute(java.lang.String name, java.lang.String value) throws java.io.IOExceptionDescription copied from interface:XMLOutputAdd an attribute to a started tag. Must follow a call to startTag.- Specified by:
addAttributein interfaceXMLOutput- Parameters:
name- the attribute name.value- the attribute value, unescaped.- Throws:
java.io.IOException
-
stopTag
public void stopTag(boolean close) throws java.io.IOExceptionDescription copied from interface:XMLOutputEnd a started tag. Must follow a call to startTag.
-
emitTag
private void emitTag(java.lang.String tagName, boolean close) throws java.io.IOException- Throws:
java.io.IOException
-
emitTag
private void emitTag(java.lang.String tagName, java.lang.String attributes, boolean close) throws java.io.IOException- Throws:
java.io.IOException
-
closeTag
public void closeTag(java.lang.String tagName) throws java.io.IOExceptionDescription copied from interface:XMLOutputClose tag with given name.
-
writeText
public void writeText(java.lang.String text) throws java.io.IOExceptionDescription copied from interface:XMLOutputWrite text to the XML document. XML metacharacters are automatically escaped.
-
writeCDATA
public void writeCDATA(java.lang.String cdata) throws java.io.IOExceptionDescription copied from interface:XMLOutputWrite a CDATA section to the XML document. The characters are not escaped in any way.- Specified by:
writeCDATAin interfaceXMLOutput- Parameters:
cdata- the character data to write- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Throws:
java.io.IOException
-
finish
@DischargesObligation public void finish() throws java.io.IOException
Description copied from interface:XMLOutputFinish 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.
-
indent
private void indent() throws java.io.IOException- Throws:
java.io.IOException
-
-