Class OutputManager
- java.lang.Object
-
- org.apache.batik.transcoder.svg2svg.OutputManager
-
public class OutputManager extends java.lang.ObjectThis class is responsible of the output of XML constructs.- Version:
- $Id: OutputManager.java 1804130 2017-08-04 14:41:11Z ssteiner $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOutputManager.AttributeInfoTo store the informations about an attribute.static classOutputManager.NameInfoTo store the informations about a name.
-
Field Summary
Fields Modifier and Type Field Description protected booleancanIndentWhether the next markup can be indented.protected intcolumnThe current column.protected intlevelThe indentation level.protected intlineThe current line.protected booleanlineAttributesWhether the attribute layout must be done on a single line.protected java.lang.StringBuffermarginThe margin.protected PrettyPrinterprettyPrinterThe pretty printer.protected java.util.ListstartingLinesThe elements starting lines.protected java.io.WriterwriterThe writer used to output the tokens.protected java.util.ListxmlSpaceThe xml:space values.
-
Constructor Summary
Constructors Constructor Description OutputManager(PrettyPrinter pp, java.io.Writer w)Creates a new output manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanformatText(char[] text, java.lang.String margin, boolean preceedingSpace)Formats the given text.protected booleanisWhiteSpace(char[] text)Tells whether the given character represents white spaces.protected intnewlines(char[] text)Returns the number of newlines in the given char array.voidprintAttlistEnd(char[] space)Prints an attribute list declaration end.voidprintAttlistStart(char[] space, char[] name)Prints an attribute list declaration start.voidprintAttName(char[] space1, char[] name, char[] space2)Prints an attribute declaration start.voidprintCDATASection(char[] data)Prints a CDATA section.voidprintCharacter(char c)Prints a single character.booleanprintCharacterData(char[] data, boolean first, boolean preceedingSpace)Prints the character data of an element content.voidprintCharacterEntityReference(char[] code, boolean first, boolean preceedingSpace)Prints a character entity reference.voidprintCharacters(char[] ca)Prints a char array.voidprintComment(char[] text)Prints a comment.voidprintDoctypeEnd(char[] space)Prints the portion of the doctype after ']'.voidprintDoctypeStart(char[] space1, char[] root, char[] space2, java.lang.String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5)Prints the portion of the doctype before '['.voidprintElementEnd(char[] name, char[] space)Prints the end of an element.voidprintElementStart(char[] name, java.util.List attributes, char[] space)Prints the start of an element.voidprintEntityReference(char[] name, boolean first)Prints an entity reference.voidprintEnumeration(java.util.List names)Prints an enumeration.voidprintNewline()Prints a newline.voidprintNotation(char[] space1, char[] name, char[] space2, java.lang.String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5)Prints a notation declaration.voidprintParameterEntityReference(char[] name)Prints a parameter entity reference.voidprintPI(char[] target, char[] space, char[] data)Prints a processing instruction.voidprintSpaces(char[] text, boolean opt)Prints white spaces.voidprintString(java.lang.String s)Prints a string.voidprintTopSpaces(char[] text)Prints top level white spaces.voidprintXMLDecl(char[] space1, char[] space2, char[] space3, char[] version, char versionDelim, char[] space4, char[] space5, char[] space6, char[] encoding, char encodingDelim, char[] space7, char[] space8, char[] space9, char[] standalone, char standaloneDelim, char[] space10)Prints an XML declaration.
-
-
-
Field Detail
-
prettyPrinter
protected PrettyPrinter prettyPrinter
The pretty printer.
-
writer
protected java.io.Writer writer
The writer used to output the tokens.
-
level
protected int level
The indentation level.
-
margin
protected java.lang.StringBuffer margin
The margin.
-
line
protected int line
The current line.
-
column
protected int column
The current column.
-
xmlSpace
protected java.util.List xmlSpace
The xml:space values.
-
canIndent
protected boolean canIndent
Whether the next markup can be indented.
-
startingLines
protected java.util.List startingLines
The elements starting lines.
-
lineAttributes
protected boolean lineAttributes
Whether the attribute layout must be done on a single line.
-
-
Constructor Detail
-
OutputManager
public OutputManager(PrettyPrinter pp, java.io.Writer w)
Creates a new output manager.- Parameters:
pp- The PrettyPrinter used for formatting the output.w- The Writer to write the output to.
-
-
Method Detail
-
printCharacter
public void printCharacter(char c) throws java.io.IOExceptionPrints a single character.- Throws:
java.io.IOException
-
printNewline
public void printNewline() throws java.io.IOExceptionPrints a newline.- Throws:
java.io.IOException
-
printString
public void printString(java.lang.String s) throws java.io.IOExceptionPrints a string.- Throws:
java.io.IOException
-
printCharacters
public void printCharacters(char[] ca) throws java.io.IOExceptionPrints a char array.- Throws:
java.io.IOException
-
printSpaces
public void printSpaces(char[] text, boolean opt) throws java.io.IOExceptionPrints white spaces.- Parameters:
text- The space text.opt- whether the space is optional.- Throws:
java.io.IOException
-
printTopSpaces
public void printTopSpaces(char[] text) throws java.io.IOExceptionPrints top level white spaces.- Parameters:
text- The space text.- Throws:
java.io.IOException
-
printComment
public void printComment(char[] text) throws java.io.IOExceptionPrints a comment.- Parameters:
text- The comment text.- Throws:
java.io.IOException
-
printXMLDecl
public void printXMLDecl(char[] space1, char[] space2, char[] space3, char[] version, char versionDelim, char[] space4, char[] space5, char[] space6, char[] encoding, char encodingDelim, char[] space7, char[] space8, char[] space9, char[] standalone, char standaloneDelim, char[] space10) throws java.io.IOExceptionPrints an XML declaration.- Throws:
java.io.IOException
-
printPI
public void printPI(char[] target, char[] space, char[] data) throws java.io.IOExceptionPrints a processing instruction.- Throws:
java.io.IOException
-
printDoctypeStart
public void printDoctypeStart(char[] space1, char[] root, char[] space2, java.lang.String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5) throws java.io.IOExceptionPrints the portion of the doctype before '['.- Throws:
java.io.IOException
-
printDoctypeEnd
public void printDoctypeEnd(char[] space) throws java.io.IOExceptionPrints the portion of the doctype after ']'.- Throws:
java.io.IOException
-
printParameterEntityReference
public void printParameterEntityReference(char[] name) throws java.io.IOExceptionPrints a parameter entity reference.- Throws:
java.io.IOException
-
printEntityReference
public void printEntityReference(char[] name, boolean first) throws java.io.IOExceptionPrints an entity reference.- Throws:
java.io.IOException
-
printCharacterEntityReference
public void printCharacterEntityReference(char[] code, boolean first, boolean preceedingSpace) throws java.io.IOExceptionPrints a character entity reference.- Throws:
java.io.IOException
-
printElementStart
public void printElementStart(char[] name, java.util.List attributes, char[] space) throws java.io.IOExceptionPrints the start of an element.- Throws:
java.io.IOException
-
printElementEnd
public void printElementEnd(char[] name, char[] space) throws java.io.IOExceptionPrints the end of an element.- Throws:
java.io.IOException
-
printCharacterData
public boolean printCharacterData(char[] data, boolean first, boolean preceedingSpace) throws java.io.IOExceptionPrints the character data of an element content.- Throws:
java.io.IOException
-
printCDATASection
public void printCDATASection(char[] data) throws java.io.IOExceptionPrints a CDATA section.- Throws:
java.io.IOException
-
printNotation
public void printNotation(char[] space1, char[] name, char[] space2, java.lang.String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5) throws java.io.IOExceptionPrints a notation declaration.- Throws:
java.io.IOException
-
printAttlistStart
public void printAttlistStart(char[] space, char[] name) throws java.io.IOExceptionPrints an attribute list declaration start.- Throws:
java.io.IOException
-
printAttlistEnd
public void printAttlistEnd(char[] space) throws java.io.IOExceptionPrints an attribute list declaration end.- Throws:
java.io.IOException
-
printAttName
public void printAttName(char[] space1, char[] name, char[] space2) throws java.io.IOExceptionPrints an attribute declaration start.- Throws:
java.io.IOException
-
printEnumeration
public void printEnumeration(java.util.List names) throws java.io.IOExceptionPrints an enumeration.- Throws:
java.io.IOException
-
newlines
protected int newlines(char[] text)
Returns the number of newlines in the given char array.
-
isWhiteSpace
protected boolean isWhiteSpace(char[] text)
Tells whether the given character represents white spaces.
-
formatText
protected boolean formatText(char[] text, java.lang.String margin, boolean preceedingSpace) throws java.io.IOExceptionFormats the given text.- Throws:
java.io.IOException
-
-