Package groovy.io
Class GroovyPrintStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.PrintStream
groovy.io.GroovyPrintStream
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
public class GroovyPrintStream extends 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(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.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. -
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
-
Constructor Details
-
GroovyPrintStream
Creates a new print stream. This stream will not flush automatically.- See Also:
PrintStream(java.io.OutputStream)
-
GroovyPrintStream
Creates a new print stream. -
GroovyPrintStream
public GroovyPrintStream(OutputStream out, boolean autoFlush, String encoding) throws UnsupportedEncodingExceptionCreates a new print stream. -
GroovyPrintStream
Creates a new print stream, without automatic line flushing, with the specified file name.- Throws:
FileNotFoundException
- See Also:
PrintStream(String)
-
GroovyPrintStream
public GroovyPrintStream(String fileName, String csn) throws FileNotFoundException, UnsupportedEncodingExceptionCreates a new print stream, without automatic line flushing, with the specified file name and charset.- Throws:
FileNotFoundException
UnsupportedEncodingException
- See Also:
PrintStream(String, String)
-
GroovyPrintStream
Creates a new print stream, without automatic line flushing, with the specified file.- Throws:
FileNotFoundException
- See Also:
PrintStream(File)
-
GroovyPrintStream
public GroovyPrintStream(File file, String csn) throws FileNotFoundException, UnsupportedEncodingExceptionCreates a new print stream, without automatic line flushing, with the specified file and charset.- Throws:
FileNotFoundException
UnsupportedEncodingException
- See Also:
PrintStream(File, String)
-
-
Method Details
-
print
Prints an object Groovy style.- Overrides:
print
in classPrintStream
- Parameters:
obj
- TheObject
to be printed
-
println
Prints an object Groovy style followed by a newline.- Overrides:
println
in classPrintStream
- Parameters:
obj
- TheObject
to be printed
-