Read the first line of a file

Snippet to read the first line of a file in Groovy.

def line
new File("test.txt").withReader { line = it.readLine() }
println line