java.io
Class Reader

Method Summary
void eachLine(groovy.lang.Closure closure)
Iterates through the given reader line by line
void filterLine(java.io.Writer writer, groovy.lang.Closure closure)
Filter the lines from a reader and write them on the writer, according to a closure which returns true or false
groovy.lang.Writable filterLine(groovy.lang.Closure closure)
Filter the lines of a Reader and create a Writable in return to stream the filtered lines
java.lang.String getText()
Reads the content of the Reader and returns it as a String
java.util.Iterator iterator()
java.lang.String readLine()
Read a single, whole line from the given Reader
java.util.List readLines()
Reads the reader into a list of Strings for each line
void splitEachLine(java.lang.String sep, groovy.lang.Closure closure)
Iterates through the given reader line by line, splitting on the separator
void transformChar(java.io.Writer writer, groovy.lang.Closure closure)
Transforms the characters from a self with a Closure and writes them to a writer
void transformLine(java.io.Writer writer, groovy.lang.Closure closure)
Transforms the lines from a reader with a Closure and write them to a writer
void withReader(groovy.lang.Closure closure)
Allows a Reader to be used, calling the closure with the reader and then ensuring that the reader is closed down again irrespective of whether exceptions occur or the
 
Method Detail

eachLine

public void eachLine(groovy.lang.Closure closure)
Iterates through the given reader line by line. The Reader is closed afterwards

Parameters:
closure - a closure.

filterLine

public void filterLine(java.io.Writer writer, groovy.lang.Closure closure)
Filter the lines from a reader and write them on the writer, according to a closure which returns true or false. Both Reader and Writer are closed after the operation.

Parameters:
writer - a writer, closed after the call.
closure - the closure which returns booleans.

filterLine

public groovy.lang.Writable filterLine(groovy.lang.Closure closure)
Filter the lines of a Reader and create a Writable in return to stream the filtered lines.

Parameters:
closure - a closure returning a boolean indicating to filter or not a line.
Returns:
a Writable closure

getText

public java.lang.String getText()
Reads the content of the Reader and returns it as a String

Returns:
a String containing the content of the buffered reader

iterator

public java.util.Iterator iterator()

Returns:
an Iterator for the Reader

readLine

public java.lang.String readLine()
Read a single, whole line from the given Reader

Returns:
a line

readLines

public java.util.List readLines()
Reads the reader into a list of Strings for each line

Returns:
a List of lines

splitEachLine

public void splitEachLine(java.lang.String sep, groovy.lang.Closure closure)
Iterates through the given reader line by line, splitting on the separator. The Reader is closed afterwards.

Parameters:
sep - a String separator.
closure - a closure.

transformChar

public void transformChar(java.io.Writer writer, groovy.lang.Closure closure)
Transforms the characters from a self with a Closure and writes them to a writer.

Parameters:
writer - a Writer to receive the transformed characters.
closure - a closure that performs the required transformation.

transformLine

public void transformLine(java.io.Writer writer, groovy.lang.Closure closure)
Transforms the lines from a reader with a Closure and write them to a writer. Both Reader and Writer are closed after the operation

Parameters:
writer - Where transformed lines are written. Writer is closed afterwards..
closure - Single parameter closure that is called to transform each line of text from the reader, before writing it to the writer..

withReader

public void withReader(groovy.lang.Closure closure)
Allows a Reader to be used, calling the closure with the reader and then ensuring that the reader is closed down again irrespective of whether exceptions occur or the

Parameters:
closure - the closure that the writer is passed into.