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 Summary
Fields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
Constructors 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 Summary
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, write, writeBytes
Methods inherited from class java.io.OutputStream
nullOutputStream
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
GroovyPrintStream
public GroovyPrintStream(java.io.OutputStream out)Creates a new print stream. This stream will not flush automatically.- See Also:
PrintStream(java.io.OutputStream)
-
GroovyPrintStream
public GroovyPrintStream(java.io.OutputStream out, boolean autoFlush)Creates a new print stream.- See Also:
PrintStream(java.io.OutputStream, boolean)
-
GroovyPrintStream
public 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)
-
GroovyPrintStream
public 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)
-
GroovyPrintStream
public 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)
-
GroovyPrintStream
public 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)
-
GroovyPrintStream
public 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
-
print
public void print(java.lang.Object obj)Prints an object Groovy style.- Overrides:
print
in classjava.io.PrintStream
- Parameters:
obj
- TheObject
to be printed
-
println
public void println(java.lang.Object obj)Prints an object Groovy style followed by a newline.- Overrides:
println
in classjava.io.PrintStream
- Parameters:
obj
- TheObject
to be printed
-