Class OutputManager

java.lang.Object
org.apache.batik.transcoder.svg2svg.OutputManager

public class OutputManager extends Object
This class is responsible of the output of XML constructs.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    To store the informations about an attribute.
    static class 
    To store the informations about a name.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    Whether the next markup can be indented.
    protected int
    The current column.
    protected int
    The indentation level.
    protected int
    The current line.
    protected boolean
    Whether the attribute layout must be done on a single line.
    protected StringBuffer
    The margin.
    protected PrettyPrinter
    The pretty printer.
    protected List
    The elements starting lines.
    protected Writer
    The writer used to output the tokens.
    protected List
    The xml:space values.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new output manager.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    formatText(char[] text, String margin, boolean preceedingSpace)
    Formats the given text.
    protected boolean
    isWhiteSpace(char[] text)
    Tells whether the given character represents white spaces.
    protected int
    newlines(char[] text)
    Returns the number of newlines in the given char array.
    void
    printAttlistEnd(char[] space)
    Prints an attribute list declaration end.
    void
    printAttlistStart(char[] space, char[] name)
    Prints an attribute list declaration start.
    void
    printAttName(char[] space1, char[] name, char[] space2)
    Prints an attribute declaration start.
    void
    printCDATASection(char[] data)
    Prints a CDATA section.
    void
    Prints a single character.
    boolean
    printCharacterData(char[] data, boolean first, boolean preceedingSpace)
    Prints the character data of an element content.
    void
    printCharacterEntityReference(char[] code, boolean first, boolean preceedingSpace)
    Prints a character entity reference.
    void
    printCharacters(char[] ca)
    Prints a char array.
    void
    printComment(char[] text)
    Prints a comment.
    void
    printDoctypeEnd(char[] space)
    Prints the portion of the doctype after ']'.
    void
    printDoctypeStart(char[] space1, char[] root, char[] space2, String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5)
    Prints the portion of the doctype before '['.
    void
    printElementEnd(char[] name, char[] space)
    Prints the end of an element.
    void
    printElementStart(char[] name, List attributes, char[] space)
    Prints the start of an element.
    void
    printEntityReference(char[] name, boolean first)
    Prints an entity reference.
    void
    Prints an enumeration.
    void
    Prints a newline.
    void
    printNotation(char[] space1, char[] name, char[] space2, String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5)
    Prints a notation declaration.
    void
    Prints a parameter entity reference.
    void
    printPI(char[] target, char[] space, char[] data)
    Prints a processing instruction.
    void
    printSpaces(char[] text, boolean opt)
    Prints white spaces.
    void
    Prints a string.
    void
    printTopSpaces(char[] text)
    Prints top level white spaces.
    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)
    Prints an XML declaration.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • prettyPrinter

      protected PrettyPrinter prettyPrinter
      The pretty printer.
    • writer

      protected Writer writer
      The writer used to output the tokens.
    • level

      protected int level
      The indentation level.
    • margin

      protected StringBuffer margin
      The margin.
    • line

      protected int line
      The current line.
    • column

      protected int column
      The current column.
    • xmlSpace

      protected List xmlSpace
      The xml:space values.
    • canIndent

      protected boolean canIndent
      Whether the next markup can be indented.
    • startingLines

      protected List startingLines
      The elements starting lines.
    • lineAttributes

      protected boolean lineAttributes
      Whether the attribute layout must be done on a single line.
  • Constructor Details

    • OutputManager

      public OutputManager(PrettyPrinter pp, 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 Details

    • printCharacter

      public void printCharacter(char c) throws IOException
      Prints a single character.
      Throws:
      IOException
    • printNewline

      public void printNewline() throws IOException
      Prints a newline.
      Throws:
      IOException
    • printString

      public void printString(String s) throws IOException
      Prints a string.
      Throws:
      IOException
    • printCharacters

      public void printCharacters(char[] ca) throws IOException
      Prints a char array.
      Throws:
      IOException
    • printSpaces

      public void printSpaces(char[] text, boolean opt) throws IOException
      Prints white spaces.
      Parameters:
      text - The space text.
      opt - whether the space is optional.
      Throws:
      IOException
    • printTopSpaces

      public void printTopSpaces(char[] text) throws IOException
      Prints top level white spaces.
      Parameters:
      text - The space text.
      Throws:
      IOException
    • printComment

      public void printComment(char[] text) throws IOException
      Prints a comment.
      Parameters:
      text - The comment text.
      Throws:
      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 IOException
      Prints an XML declaration.
      Throws:
      IOException
    • printPI

      public void printPI(char[] target, char[] space, char[] data) throws IOException
      Prints a processing instruction.
      Throws:
      IOException
    • printDoctypeStart

      public void printDoctypeStart(char[] space1, char[] root, char[] space2, String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5) throws IOException
      Prints the portion of the doctype before '['.
      Throws:
      IOException
    • printDoctypeEnd

      public void printDoctypeEnd(char[] space) throws IOException
      Prints the portion of the doctype after ']'.
      Throws:
      IOException
    • printParameterEntityReference

      public void printParameterEntityReference(char[] name) throws IOException
      Prints a parameter entity reference.
      Throws:
      IOException
    • printEntityReference

      public void printEntityReference(char[] name, boolean first) throws IOException
      Prints an entity reference.
      Throws:
      IOException
    • printCharacterEntityReference

      public void printCharacterEntityReference(char[] code, boolean first, boolean preceedingSpace) throws IOException
      Prints a character entity reference.
      Throws:
      IOException
    • printElementStart

      public void printElementStart(char[] name, List attributes, char[] space) throws IOException
      Prints the start of an element.
      Throws:
      IOException
    • printElementEnd

      public void printElementEnd(char[] name, char[] space) throws IOException
      Prints the end of an element.
      Throws:
      IOException
    • printCharacterData

      public boolean printCharacterData(char[] data, boolean first, boolean preceedingSpace) throws IOException
      Prints the character data of an element content.
      Throws:
      IOException
    • printCDATASection

      public void printCDATASection(char[] data) throws IOException
      Prints a CDATA section.
      Throws:
      IOException
    • printNotation

      public void printNotation(char[] space1, char[] name, char[] space2, String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5) throws IOException
      Prints a notation declaration.
      Throws:
      IOException
    • printAttlistStart

      public void printAttlistStart(char[] space, char[] name) throws IOException
      Prints an attribute list declaration start.
      Throws:
      IOException
    • printAttlistEnd

      public void printAttlistEnd(char[] space) throws IOException
      Prints an attribute list declaration end.
      Throws:
      IOException
    • printAttName

      public void printAttName(char[] space1, char[] name, char[] space2) throws IOException
      Prints an attribute declaration start.
      Throws:
      IOException
    • printEnumeration

      public void printEnumeration(List names) throws IOException
      Prints an enumeration.
      Throws:
      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, String margin, boolean preceedingSpace) throws IOException
      Formats the given text.
      Throws:
      IOException