[Java] Class GroovyPrintStream

  • groovy.io.GroovyPrintStream

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

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

Methods Summary

Methods
Type Params Return Type Name and description
void print(Object obj)
Prints an object Groovy style.
void println(Object obj)
Prints an object Groovy style followed by a newline.

Inherited Methods Summary

Inherited Methods
Methods inherited from class Name
class PrintStream println, println, println, println, println, println, println, println, println, println, append, append, append, append, append, append, format, format, write, write, print, print, print, print, print, print, print, print, print, close, flush, checkError, printf, printf, write, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
class FilterOutputStream write, write, write, close, flush, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Constructor Detail

public GroovyPrintStream(OutputStream out)

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

See Also:
PrintStream.PrintStream

public GroovyPrintStream(OutputStream out, boolean autoFlush)

Creates a new print stream.

See Also:
PrintStream.PrintStream

public GroovyPrintStream(OutputStream out, boolean autoFlush, String encoding)

Creates a new print stream.

See Also:
PrintStream.PrintStream

public GroovyPrintStream(String fileName)

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

See Also:
PrintStream.PrintStream

public GroovyPrintStream(String fileName, String csn)

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

See Also:
PrintStream.PrintStream

public GroovyPrintStream(File file)

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

See Also:
PrintStream.PrintStream

public GroovyPrintStream(File file, String csn)

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

See Also:
PrintStream.PrintStream

Method Detail

public void print(Object obj)

Prints an object Groovy style.

Parameters:
obj - The Object to be printed

public void println(Object obj)

Prints an object Groovy style followed by a newline.

Parameters:
obj - The Object to be printed

© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/2.4.21/html/gapi/groovy/io/GroovyPrintStream.html