Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
To read all lines from a file, call the getLines method on a scala.io.Source object:
import scala.io.Source
val source = Source.fromFile("myfile.txt", "UTF-8")
// The first argument can be a string or a java.io.File
// You can omit the encoding if you know that the file uses
// the default platform encoding
val lineIterator = source.getLines