groovy.io

## Class GroovyPrintStream

- java.lang.Object
- - java.io.OutputStream
  - - java.io.FilterOutputStream
    - - java.io.PrintStream
      - - groovy.io.GroovyPrintStream

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

    public class GroovyPrintStream
    extends java.io.PrintStream

A PrintStream 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.FilterOutputStream

`out`

### Constructor Summary

Constructors
Constructor and Description
`GroovyPrintStream(java.io.File file)` Creates a new print stream, without automatic line flushing, with the specified file.
`GroovyPrintStream(java.io.File file, java.lang.String csn)` Creates a new print stream, without automatic line flushing, with the specified file and charset.
`GroovyPrintStream(java.io.OutputStream out)` Creates a new print stream.
`GroovyPrintStream(java.io.OutputStream out, boolean autoFlush)` Creates a new print stream.
`GroovyPrintStream(java.io.OutputStream out, boolean autoFlush, java.lang.String encoding)` Creates a new print stream.
`GroovyPrintStream(java.lang.String fileName)` Creates a new print stream, without automatic line flushing, with the specified file name.
`GroovyPrintStream(java.lang.String fileName, java.lang.String csn)` Creates a new print stream, without automatic line flushing, with the specified file name and charset.

### Method Summary

Methods
`void` `print(java.lang.Object obj)` Prints an object Groovy style.
`void` `println(java.lang.Object obj)` Prints an object Groovy style followed by a newline.

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

`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`

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

`write`

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

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

### Constructor Detail

#### GroovyPrintStream

    public GroovyPrintStream(java.io.OutputStream out)

Creates a new print stream. This stream will not flush automatically.

See Also:
  `PrintStream.PrintStream(java.io.OutputStream)`

#### GroovyPrintStream

    public GroovyPrintStream(java.io.OutputStream out,
                     boolean autoFlush)

Creates a new print stream.

See Also:
  `PrintStream.PrintStream(java.io.OutputStream, boolean)`

#### GroovyPrintStream

    public GroovyPrintStream(java.io.OutputStream out,
                     boolean autoFlush,
                     java.lang.String encoding)
                      throws java.io.UnsupportedEncodingException

Creates a new print stream.

Throws:
  `java.io.UnsupportedEncodingException`
See Also:
  `PrintStream.PrintStream(java.io.OutputStream, boolean, String)`

#### GroovyPrintStream

    public GroovyPrintStream(java.lang.String fileName)
                      throws java.io.FileNotFoundException

Creates a new print stream, without automatic line flushing, with the specified file name.

Throws:
  `java.io.FileNotFoundException`
See Also:
  `PrintStream.PrintStream(String)`

#### GroovyPrintStream

    public GroovyPrintStream(java.lang.String fileName,
                     java.lang.String csn)
                      throws java.io.FileNotFoundException,
                             java.io.UnsupportedEncodingException

Creates a new print stream, without automatic line flushing, with the specified file name and charset.

Throws:
  `java.io.FileNotFoundException`
  `java.io.UnsupportedEncodingException`
See Also:
  `PrintStream.PrintStream(String, String)`

#### GroovyPrintStream

    public GroovyPrintStream(java.io.File file)
                      throws java.io.FileNotFoundException

Creates a new print stream, without automatic line flushing, with the specified file.

Throws:
  `java.io.FileNotFoundException`
See Also:
  `PrintStream.PrintStream(File)`

#### GroovyPrintStream

    public GroovyPrintStream(java.io.File file,
                     java.lang.String csn)
                      throws java.io.FileNotFoundException,
                             java.io.UnsupportedEncodingException

Creates a new print stream, without automatic line flushing, with the specified file and charset.

Throws:
  `java.io.FileNotFoundException`
  `java.io.UnsupportedEncodingException`
See Also:
  `PrintStream.PrintStream(File, String)`

### Method Detail

#### print

    public void print(java.lang.Object obj)

Prints an object Groovy style.

Overrides:
  `print` in class `java.io.PrintStream`
Parameters:
  `obj` - The `Object` to be printed

#### println

    public void println(java.lang.Object obj)

Prints an object Groovy style followed by a newline.

Overrides:
  `println` in class `java.io.PrintStream`
Parameters:
  `obj` - The `Object` to be printed