Groovy Documentation

## groovy.io
[Java] Class GroovyPrintStream

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

    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).

Authors:
  Jim White

Since:
  1.6

Constructor Summary
`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.
`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.

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

java.io.PrintStream#println(), java.io.PrintStream#println(boolean), java.io.PrintStream#println(char), java.io.PrintStream#println(int), java.io.PrintStream#println(long), java.io.PrintStream#println(float), java.io.PrintStream#println(double), java.io.PrintStream#println([C), java.io.PrintStream#println(java.lang.String), java.io.PrintStream#println(java.lang.Object), java.io.PrintStream#append(java.lang.CharSequence), java.io.PrintStream#append(java.lang.CharSequence, int, int), java.io.PrintStream#append(char), java.io.PrintStream#append(char), java.io.PrintStream#append(java.lang.CharSequence, int, int), java.io.PrintStream#append(java.lang.CharSequence), java.io.PrintStream#format(java.lang.String, [Ljava.lang.Object;), java.io.PrintStream#format(java.util.Locale, java.lang.String, [Ljava.lang.Object;), java.io.PrintStream#write(int), java.io.PrintStream#write([B, int, int), java.io.PrintStream#print(boolean), java.io.PrintStream#print(char), java.io.PrintStream#print(int), java.io.PrintStream#print(long), java.io.PrintStream#print(float), java.io.PrintStream#print(double), java.io.PrintStream#print([C), java.io.PrintStream#print(java.lang.String), java.io.PrintStream#print(java.lang.Object), java.io.PrintStream#flush(), java.io.PrintStream#close(), java.io.PrintStream#checkError(), java.io.PrintStream#printf(java.lang.String, [Ljava.lang.Object;), java.io.PrintStream#printf(java.util.Locale, java.lang.String, [Ljava.lang.Object;), java.io.PrintStream#write([B), java.io.PrintStream#wait(long), java.io.PrintStream#wait(long, int), java.io.PrintStream#wait(), java.io.PrintStream#equals(java.lang.Object), java.io.PrintStream#toString(), java.io.PrintStream#hashCode(), java.io.PrintStream#getClass(), java.io.PrintStream#notify(), java.io.PrintStream#notifyAll()

Methods inherited from class java.io.FilterOutputStream

java.io.FilterOutputStream#write(int), java.io.FilterOutputStream#write([B), java.io.FilterOutputStream#write([B, int, int), java.io.FilterOutputStream#flush(), java.io.FilterOutputStream#close(), java.io.FilterOutputStream#wait(long), java.io.FilterOutputStream#wait(long, int), java.io.FilterOutputStream#wait(), java.io.FilterOutputStream#equals(java.lang.Object), java.io.FilterOutputStream#toString(), java.io.FilterOutputStream#hashCode(), java.io.FilterOutputStream#getClass(), java.io.FilterOutputStream#notify(), java.io.FilterOutputStream#notifyAll()

Constructor Detail

### GroovyPrintStream

    public GroovyPrintStream(java.io.OutputStream out)

  Creates a new print stream. This stream will not flush automatically.
  See Also:
    java.io.PrintStream#PrintStream(java.io.OutputStream)

### GroovyPrintStream

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

  Creates a new print stream.
  See Also:
    java.io.PrintStream#PrintStream(java.io.OutputStream, boolean)

### GroovyPrintStream

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

  Creates a new print stream.
  See Also:
    java.io.PrintStream#PrintStream(java.io.OutputStream, boolean, String)

### GroovyPrintStream

    public GroovyPrintStream(java.lang.String fileName)

  Creates a new print stream, without automatic line flushing, with the specified file name.
  See Also:
    java.io.PrintStream#PrintStream(String)

### GroovyPrintStream

    public 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.
  See Also:
    java.io.PrintStream#PrintStream(String, String)

### GroovyPrintStream

    public GroovyPrintStream(java.io.File file)

  Creates a new print stream, without automatic line flushing, with the specified file.
  See Also:
    java.io.PrintStream#PrintStream(File)

### GroovyPrintStream

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

  Creates a new print stream, without automatic line flushing, with the specified file and charset.
  See Also:
    java.io.PrintStream#PrintStream(File, String)

Method Detail

### print

    public void print(java.lang.Object obj)

  Prints an object Groovy style.
  Parameters:
    `obj` - The `Object` to be printed

### println

    public void println(java.lang.Object obj)

  Prints an object Groovy style followed by a newline.
  Parameters:
    `obj` - The `Object` to be printed

Groovy Documentation