scala读文件:
example:
scala> import scala.io.Source
import scala.io.Source
scala> var inputFile = Source.fromFile("text.txt")
inputFile: scala.io.BufferedSource = non-empty iterator
scala> for ( line <- inputFile.getLines()) println(line)
hello panzidong
spark is good
scala> inputFile.close()