Groovy JDK

java.io
Class Writer

Method Summary
Writer leftShift(Object)
Overloads the left shift operator to provide a mechanism to append values to a writer.
PrintWriter newPrintWriter()
Create a new PrintWriter for this file, using specified charset.
Object withPrintWriter(Closure)
Create a new PrintWriter with a specified charset for this file.
Object withWriter(Closure)
Allows this writer to be used within the closure, ensuring that it is flushed and closed before this method returns.
void write(Writable)
A helper method so that dynamic dispatch of the writer.write(object) method will always use the more efficient Writable.writeTo(writer) mechanism if the object implements the Writable interface.
 
Method Detail

leftShift

public Writer leftShift(Object)
 
Overloads the left shift operator to provide a mechanism to append values to a writer.
Parameters:
value - a value to append.
Returns:
the writer on which this operation was invoked
Since:
1.0

newPrintWriter

public PrintWriter newPrintWriter()
 
Create a new PrintWriter for this file, using specified charset.
Returns:
a PrintWriter
Since:
1.6.0

withPrintWriter

public Object withPrintWriter(Closure)
 
Create a new PrintWriter with a specified charset for this file. The writer is passed to the closure, and will be closed before this method returns.
Parameters:
closure - the closure to invoke with the PrintWriter.
Returns:
the value returned by the closure
Since:
1.6.0

withWriter

public Object withWriter(Closure)
 
Allows this writer to be used within the closure, ensuring that it is flushed and closed before this method returns.
Parameters:
closure - the closure that the writer is passed into.
Returns:
the value returned by the closure
Since:
1.5.2

write

public void write(Writable)
 
A helper method so that dynamic dispatch of the writer.write(object) method will always use the more efficient Writable.writeTo(writer) mechanism if the object implements the Writable interface.
Parameters:
writable - an object implementing the Writable interface.
Since:
1.0

Groovy JDK