Package groovy.io

# Class GroovyPrintWriter

java.lang.Object
java.io.Writer
java.io.PrintWriter
groovy.io.GroovyPrintWriter

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

    public class GroovyPrintWriter
    extends java.io.PrintWriter

A PrintWriter that outputs objects in Groovy style. That means print(Object) uses InvokerHelper.toString(Object) to produce the same results as Writer.print(Object).

Since:
  1.6

- ## Field Summary

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

  `out`

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

  `lock`

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `GroovyPrintWriter​(java.io.File file)` |
  `GroovyPrintWriter​(java.io.File file, java.lang.String csn)` |
  `GroovyPrintWriter​(java.io.OutputStream out)` |
  `GroovyPrintWriter​(java.io.OutputStream out, boolean autoflush)` |
  `GroovyPrintWriter​(java.io.Writer out)` |
  `GroovyPrintWriter​(java.io.Writer out, boolean autoflush)` |
  `GroovyPrintWriter​(java.lang.String filename)` |
  `GroovyPrintWriter​(java.lang.String filename, java.lang.String csn)` |

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `void` | `print​(java.lang.Object x)` |
  `void` | `println​(java.lang.Object x)` |

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

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

  ### Methods inherited from class java.io.Writer

  `nullWriter`

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

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

- ## Constructor Details

  - ### GroovyPrintWriter

    public GroovyPrintWriter​(java.io.File file) throws java.io.FileNotFoundException
    Throws:
      `java.io.FileNotFoundException`

  - ### GroovyPrintWriter

    public GroovyPrintWriter​(java.io.File file, java.lang.String csn) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException
    Throws:
      `java.io.FileNotFoundException`
      `java.io.UnsupportedEncodingException`

  - ### GroovyPrintWriter

    public GroovyPrintWriter​(java.io.Writer out)

  - ### GroovyPrintWriter

    public GroovyPrintWriter​(java.io.Writer out, boolean autoflush)

  - ### GroovyPrintWriter

    public GroovyPrintWriter​(java.io.OutputStream out)

  - ### GroovyPrintWriter

    public GroovyPrintWriter​(java.io.OutputStream out, boolean autoflush)

  - ### GroovyPrintWriter

    public GroovyPrintWriter​(java.lang.String filename) throws java.io.FileNotFoundException
    Throws:
      `java.io.FileNotFoundException`

  - ### GroovyPrintWriter

    public GroovyPrintWriter​(java.lang.String filename, java.lang.String csn) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException
    Throws:
      `java.io.FileNotFoundException`
      `java.io.UnsupportedEncodingException`

- ## Method Details

  - ### print

    public void print​(java.lang.Object x)
    Overrides:
      `print` in class `java.io.PrintWriter`

  - ### println

    public void println​(java.lang.Object x)
    Overrides:
      `println` in class `java.io.PrintWriter`