bufferunderflowexception

Why do I get a java.nio.BufferUnderflowException in this Scala

I was trying to do some scripting in Scala, to process some log files: scala> import io.Source import io.Source scala> import java.io.File import java.io.File scala> val f = new File(".") f: java.io.File = . scala> for (l <- f.listFiles) { | val src = Source.fromFile(l).getLines | println( (0 /: src) { (i, line) => i + 1 } ) |...

java.nio.BufferUnderflowException when processing files in Scala

I got a similar problem to this guy while processing 4MB log file. Actually I'm processing multiple files simultaneously but since I keep getting this exception, I decide to just test it for a single file: val temp = Source.fromFile("./datasource/input.txt") val dummy = new PrintWriter("test.txt") var itr = 0 println("Default Buffer siz...