Package 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 SummaryFields inherited from class java.io.FilterOutputStreamout
- 
Constructor SummaryConstructors Constructor 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 SummaryMethods inherited from class java.io.PrintStreamappend, 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, writeBytesMethods inherited from class java.io.OutputStreamnullOutputStreamMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
- 
Constructor Details- 
GroovyPrintStreampublic GroovyPrintStream(java.io.OutputStream out)Creates a new print stream. This stream will not flush automatically.- See Also:
- PrintStream(java.io.OutputStream)
 
- 
GroovyPrintStreampublic GroovyPrintStream(java.io.OutputStream out, boolean autoFlush)Creates a new print stream.- See Also:
- PrintStream(java.io.OutputStream, boolean)
 
- 
GroovyPrintStreampublic GroovyPrintStream(java.io.OutputStream out, boolean autoFlush, java.lang.String encoding) throws java.io.UnsupportedEncodingExceptionCreates a new print stream.- Throws:
- java.io.UnsupportedEncodingException
- See Also:
- PrintStream(java.io.OutputStream, boolean, String)
 
- 
GroovyPrintStreampublic GroovyPrintStream(java.lang.String fileName) throws java.io.FileNotFoundExceptionCreates a new print stream, without automatic line flushing, with the specified file name.- Throws:
- java.io.FileNotFoundException
- See Also:
- PrintStream(String)
 
- 
GroovyPrintStreampublic GroovyPrintStream(java.lang.String fileName, java.lang.String csn) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingExceptionCreates 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(String, String)
 
- 
GroovyPrintStreampublic GroovyPrintStream(java.io.File file) throws java.io.FileNotFoundExceptionCreates a new print stream, without automatic line flushing, with the specified file.- Throws:
- java.io.FileNotFoundException
- See Also:
- PrintStream(File)
 
- 
GroovyPrintStreampublic GroovyPrintStream(java.io.File file, java.lang.String csn) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingExceptionCreates a new print stream, without automatic line flushing, with the specified file and charset.- Throws:
- java.io.FileNotFoundException
- java.io.UnsupportedEncodingException
- See Also:
- PrintStream(File, String)
 
 
- 
- 
Method Details- 
printpublic void print(java.lang.Object obj)Prints an object Groovy style.- Overrides:
- printin class- java.io.PrintStream
- Parameters:
- obj- The- Objectto be printed
 
- 
printlnpublic void println(java.lang.Object obj)Prints an object Groovy style followed by a newline.- Overrides:
- printlnin class- java.io.PrintStream
- Parameters:
- obj- The- Objectto be printed
 
 
-