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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
print(Object obj)
Prints an object Groovy style.void
println(Object obj)
Prints an object Groovy style followed by a newline.-
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
-
Methods inherited from class java.io.FilterOutputStream
write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
GroovyPrintStream
public GroovyPrintStream(OutputStream out)
Creates a new print stream. This stream will not flush automatically.- See Also:
PrintStream(java.io.OutputStream)
-
GroovyPrintStream
public GroovyPrintStream(OutputStream out, boolean autoFlush)
Creates a new print stream.
-
GroovyPrintStream
public GroovyPrintStream(OutputStream out, boolean autoFlush, String encoding) throws UnsupportedEncodingException
Creates a new print stream.
-
GroovyPrintStream
public GroovyPrintStream(String fileName) throws FileNotFoundException
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, UnsupportedEncodingException
Creates a new print stream, without automatic line flushing, with the specified file name and charset.- Throws:
FileNotFoundException
UnsupportedEncodingException
- See Also:
PrintStream(String, String)
-
GroovyPrintStream
public GroovyPrintStream(File file) throws FileNotFoundException
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, UnsupportedEncodingException
Creates a new print stream, without automatic line flushing, with the specified file and charset.- Throws:
FileNotFoundException
UnsupportedEncodingException
- See Also:
PrintStream(File, String)
-
-
Method Detail
-
print
public void print(Object obj)
Prints an object Groovy style.- Overrides:
print
in classPrintStream
- Parameters:
obj
- TheObject
to be printed
-
println
public void println(Object obj)
Prints an object Groovy style followed by a newline.- Overrides:
println
in classPrintStream
- Parameters:
obj
- TheObject
to be printed
-
-