Top Description Fields Constructors Methods
org.glassfish.jaxb.runtime.v2.runtime.output

public final Class IndentingUTF8XmlOutput

extends UTF8XmlOutput
Class Inheritance
Imports
org.glassfish.jaxb.core.marshaller.CharacterEscapeHandler, org.glassfish.jaxb.runtime.v2.runtime.Name, org.xml.sax.SAXException, javax.xml.stream.XMLStreamException, java.io.IOException, .OutputStream

UTF8XmlOutput with indentation.

Todo

not sure if it's a good idea to move the indenting functionality to another class. Doesn't have to be final, but it helps the JVM.

Author
Kohsuke Kawaguchi

Field Summary

Modifier and TypeField and Description
private int
private final Encoded
indent8

Null if the writer should perform no indentation.

private boolean
private final int
unitLen

Length of one indentation.

Inherited from org.glassfish.jaxb.runtime.v2.runtime.output.UTF8XmlOutput:
closeStartTagPendingoctetBufferoctetBufferIndexout

Constructor Summary

AccessConstructor and Description
public
IndentingUTF8XmlOutput(OutputStream out, String
set to null for no indentation and optimal performance. otherwise the string is used for indentation.
indentStr
,
Encoded[] localNames, CharacterEscapeHandler escapeHandler)

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
public void
public void
private void
private void
private void
public void
text(String value, boolean needSP)

Overrides org.glassfish.jaxb.runtime.v2.runtime.output.UTF8XmlOutput.text.

Implements org.glassfish.jaxb.runtime.v2.runtime.output.XmlOutput.text.

Writes XML text with character escaping, if necessary.

public void
text(Pcdata value, boolean needSP)

Overrides org.glassfish.jaxb.runtime.v2.runtime.output.UTF8XmlOutput.text.

Implements org.glassfish.jaxb.runtime.v2.runtime.output.XmlOutput.text.

Writes XML text with character escaping, if necessary.

Inherited from org.glassfish.jaxb.runtime.v2.runtime.output.UTF8XmlOutput:
attributeattributecloseStartTagendStartTagflushBuffersetHeaderstartDocumenttexttexttoByteswritewritewritewriteNsDeclwriteNsDecls

Field Detail

depthback to summary
private int depth
indent8back to summary
private final Encoded indent8

Null if the writer should perform no indentation. Otherwise this will keep the 8 copies of the string for indentation. (so that we can write 8 indentation at once.)

seenTextback to summary
private boolean seenText
unitLenback to summary
private final int unitLen

Length of one indentation.

Constructor Detail

IndentingUTF8XmlOutputback to summary
public IndentingUTF8XmlOutput(OutputStream out, String indentStr, Encoded[] localNames, CharacterEscapeHandler escapeHandler)
Parameters
indentStr:String

set to null for no indentation and optimal performance. otherwise the string is used for indentation.

Method Detail

beginStartTagback to summary
public void beginStartTag(int prefix, String localName) throws IOException

Overrides org.glassfish.jaxb.runtime.v2.runtime.output.UTF8XmlOutput.beginStartTag.

Implements org.glassfish.jaxb.runtime.v2.runtime.output.XmlOutput.beginStartTag.

Annotations
@Override
beginStartTagback to summary
public void beginStartTag(Name name) throws IOException

Overrides org.glassfish.jaxb.runtime.v2.runtime.output.UTF8XmlOutput.beginStartTag.

Implements org.glassfish.jaxb.runtime.v2.runtime.output.XmlOutput.beginStartTag.

Doc from org.glassfish.jaxb.runtime.v2.runtime.output.XmlOutputAbstractImpl.beginStartTag.

Writes a start tag.

At this point nsContext holds namespace declarations needed for this new element.

This method is used for writing tags that are indexed.

Annotations
@Override
endDocumentback to summary
public void endDocument(boolean fragment) throws IOException, SAXException, XMLStreamException

Overrides org.glassfish.jaxb.runtime.v2.runtime.output.UTF8XmlOutput.endDocument.

Implements org.glassfish.jaxb.runtime.v2.runtime.output.XmlOutput.endDocument.

Doc from org.glassfish.jaxb.runtime.v2.runtime.output.XmlOutputAbstractImpl.endDocument.

Called at the very end.

Annotations
@Override
endTagback to summary
public void endTag(Name name) throws IOException

Overrides org.glassfish.jaxb.runtime.v2.runtime.output.UTF8XmlOutput.endTag.

Implements org.glassfish.jaxb.runtime.v2.runtime.output.XmlOutput.endTag.

Annotations
@Override
endTagback to summary
public void endTag(int prefix, String localName) throws IOException

Overrides org.glassfish.jaxb.runtime.v2.runtime.output.UTF8XmlOutput.endTag.

Implements org.glassfish.jaxb.runtime.v2.runtime.output.XmlOutput.endTag.

Annotations
@Override
indentEndTagback to summary
private void indentEndTag() throws IOException
indentStartTagback to summary
private void indentStartTag() throws IOException
printIndentback to summary
private void printIndent() throws IOException
textback to summary
public void text(String value, boolean needSP) throws IOException

Overrides org.glassfish.jaxb.runtime.v2.runtime.output.UTF8XmlOutput.text.

Implements org.glassfish.jaxb.runtime.v2.runtime.output.XmlOutput.text.

Doc from org.glassfish.jaxb.runtime.v2.runtime.output.XmlOutput.text.

Writes XML text with character escaping, if necessary.

Annotations
@Override
textback to summary
public void text(Pcdata value, boolean needSP) throws IOException

Overrides org.glassfish.jaxb.runtime.v2.runtime.output.UTF8XmlOutput.text.

Implements org.glassfish.jaxb.runtime.v2.runtime.output.XmlOutput.text.

Doc from org.glassfish.jaxb.runtime.v2.runtime.output.XmlOutput.text.

Writes XML text with character escaping, if necessary.

Annotations
@Override