edu.northwestern.at.utils

## Class StringPrintWriter

- java.lang.Object
- - java.io.Writer
  - - java.io.PrintWriter
    - - edu.northwestern.at.utils.StringPrintWriter

- All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.Appendable, java.lang.AutoCloseable

      public class StringPrintWriter
      extends java.io.PrintWriter

  A PrintWriter that maintains a String as its backing store.

  Usage:

       StringPrintWriter out = new StringPrintWriter();
       printTo(out);
       System.out.println( out.getString() );

  Since:
    2.0
  Author:
    Alex Chaffee, Scott Stanchfield, Gary D. Gregory

- - ### Field Summary

    - ### Fields inherited from class java.io.PrintWriter

      `out`

    - ### Fields inherited from class java.io.Writer

      `lock`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StringPrintWriter()` Constructs a new instance.
    `StringPrintWriter(int initialSize)` Constructs a new instance using the specified initial string-buffer size.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getString()` Since toString() returns information *about* this object, we want a separate method to extract just the contents of the internal buffer as a String.

    - ### Methods inherited from class java.io.PrintWriter

      `append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write, write, write, write`

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

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

- - ### Constructor Detail

    - #### StringPrintWriter

          public StringPrintWriter()

      Constructs a new instance.

    - #### StringPrintWriter

          public StringPrintWriter(int initialSize)

      Constructs a new instance using the specified initial string-buffer size.
      Parameters:
        `initialSize` - an int specifying the initial size of the buffer.

  - ### Method Detail

    - #### getString

          public java.lang.String getString()

      Since toString() returns information *about* this object, we want a separate method to extract just the contents of the internal buffer as a String.

      Returns:
        the contents of the internal string buffer