全部。我正在尝试使用 CsvParser 解析 CSV 文件,但在第 57 行(约 6500 行)读取后出现 IOException: Stream closed 错误。有谁知道这可能是什么原因造成的?这是一个代码片段和错误:
#!/usr/bin/ groovy
package csvTest
@Grab ('com.xlson.groovycsv:groovycsv:1.0')
import com.xlson.groovycsv.CsvParser
def csvFile = new File("file.csv").withReader {
CsvParser.parseCsv(it)
}
csvFile.each {
println it
}
Caught: java.io.IOException: Stream closed
java.io.IOException: Stream closed
at au.com.bytecode.opencsv.CSVReader.getNextLine(CSVReader.java:245)
at au.com.bytecode.opencsv.CSVReader.readNext(CSVReader.java:212)
at au.com.bytecode.opencsv.CSVReader$readNext.call(Unknown Source)
at com.xlson.groovycsv.CsvIterator.hasNext(CsvIterator.groovy:72)
at csvTest.CsvTest.run(CsvTest.groovy:12)