File file1 = new File("C:\Build\myfolder\myTestfile.txt");
def String yourData = file1.readLines();
阅读完整文件。
File file1 = new File("C:\Build\myfolder\myfile.txt");
def String yourData= file1.getText();
逐行读取文件。
File file1 = new File("C:\Build\myfolder\myTestfile.txt");
for (def i=0;i<=30;i++) // specify how many line need to read eg.. 30
{
log.info file1.readLines().get(i)
}