|
Groovy JDK |
Method Summary | |
---|---|
Object
|
eachLine(Closure closure)
Iterates through the given reader line by line. |
Object
|
eachLine(int firstLine, Closure closure)
Iterates through the given reader line by line. |
void
|
filterLine(Writer writer, Closure closure)
Filter the lines from a reader and write them on the writer, according to a closure which returns true if the line should be included. |
Writable
|
filterLine(Closure closure)
Filter the lines from this Reader, and return a Writable which can be used to stream the filtered lines to a destination. |
String
|
getText()
Read the content of the Reader and return it as a String. |
Iterator
|
iterator()
Creates an iterator which will traverse through the reader a line at a time. |
String
|
readLine()
Read a single, whole line from the given Reader. |
List
|
readLines()
Reads the reader into a list of Strings, with one entry for each line. |
Object
|
splitEachLine(String sep, Closure closure)
Iterates through the given reader line by line, splitting each line using the given separator. |
void
|
transformChar(Writer writer, Closure closure)
Transforms each character from this reader by passing it to the given closure. |
void
|
transformLine(Writer writer, Closure closure)
Transforms the lines from a reader with a Closure and write them to a writer. |
Object
|
withReader(Closure closure)
Allows this reader to be used within the closure, ensuring that it is closed before this method returns. |
Method Detail |
---|
public Object eachLine(Closure closure)
closure
- a closure.public Object eachLine(int firstLine, Closure closure)
firstLine
- the count of the first line.closure
- a closure which will be passed each line (or for 2 argument closures the line and count).public void filterLine(Writer writer, Closure closure)
writer
- a writer, closed after the call.closure
- the closure which returns booleans.public Writable filterLine(Closure closure)
true
if the line should be passed to the writer.closure
- a closure used for filtering.public String getText()
public Iterator iterator()
public String readLine()
public List readLines()
public Object splitEachLine(String sep, Closure closure)
sep
- a String separator.closure
- a closure.public void transformChar(Writer writer, Closure closure)
writer
- a Writer to receive the transformed characters.closure
- a closure that performs the required transformation.public void transformLine(Writer writer, Closure closure)
writer
- Where transformed lines are written. Writer is closed afterwards..closure
text
- Single parameter closure that is called to transform each line of
text from the reader, before writing it to the writer..public Object withReader(Closure closure)
closure
- the closure that the writer is passed into.
|
Groovy JDK |