de.esprit.common.util

## Class TextBuilder

- java.lang.Object
- - de.esprit.common.util.TextBuilder

- All Implemented Interfaces:
    java.io.Serializable

      public class TextBuilder
      extends java.lang.Object
      implements java.io.Serializable

  The main application of this class is to generate indented textual output. Use `printUp(String)` and `printDn(String)` to produce an appropriate indentation. The resulting String can be retrieved with the `toString()` method.
  Note that this class internally uses a PrintWriter in order to ensure that CRs are converted according the platform specific encoding. This is important when the output is written to a file.
  Author:
    Rainer Buesch
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TextBuilder()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` Clears the internal buffer.
    `java.lang.String` | `getIndentString()`
    `int` | `getLineCount()`
    `int` | `getSize()` Returns the number of printed lines in this DumpString
    `TextBuilder` | `insertln(int insertIndex)`
    `TextBuilder` | `insertln(int insertIndex, java.lang.String s)`
    `boolean` | `isEmpty()` Tells whether this DumpString contains any printed lines
    `static void` | `main(java.lang.String[] args)`
    `TextBuilder` | `print(java.lang.String s)` Just prints the string without a trailing newline.
    `void` | `printDn(java.lang.String str)` Decreases the internal indentation level and prints the given String.
    `void` | `println()` Just prints a newline only.
    `TextBuilder` | `println(java.lang.Object o)`
    `TextBuilder` | `println(java.lang.String s)` Just prints the string with a trailing newline.
    `void` | `printUp(java.lang.String str)` Prints the given String and increases the internal indentation level.
    `void` | `setIndentString(java.lang.String s)`
    `java.lang.String` | `toString()` Returns the resulting string that has been printed into the buffer.
    `void` | `write(java.io.OutputStream out)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TextBuilder

          public TextBuilder()

  - ### Method Detail

    - #### print

          public TextBuilder print(java.lang.String s)

      Just prints the string without a trailing newline.

    - #### println

          public TextBuilder println(java.lang.String s)

      Just prints the string with a trailing newline.

    - #### insertln

          public TextBuilder insertln(int insertIndex)

    - #### insertln

          public TextBuilder insertln(int insertIndex,
                             java.lang.String s)

    - #### println

          public TextBuilder println(java.lang.Object o)

    - #### println

          public void println()

      Just prints a newline only.

    - #### printUp

          public void printUp(java.lang.String str)

      Prints the given String and increases the internal indentation level.

    - #### printDn

          public void printDn(java.lang.String str)

      Decreases the internal indentation level and prints the given String.

    - #### clear

          public void clear()

      Clears the internal buffer. This makes the same DumpString object reusable for further processing.

    - #### isEmpty

          public boolean isEmpty()

      Tells whether this DumpString contains any printed lines

    - #### getSize

          public int getSize()

      Returns the number of printed lines in this DumpString

    - #### toString

          public java.lang.String toString()

      Returns the resulting string that has been printed into the buffer. Note that at the time this method is called the indentation level should be back on zero! A warning is issued if this is not the case.
      Overrides:
        `toString` in class `java.lang.Object`

    - #### write

          public void write(java.io.OutputStream out)

    - #### setIndentString

          public void setIndentString(java.lang.String s)

    - #### getIndentString

          public java.lang.String getIndentString()

    - #### getLineCount

          public int getLineCount()

    - #### main

          public static void main(java.lang.String[] args)

Copyright © 2014 EsprIT-Systems. All Rights Reserved.