Basic Read Write

These examples are a quick introduction to performing basic IO using the Scala IO API

Print Lines

read and print out all lines from a URL
    import scalax.io._
    import Resource._
    import java.net.URL

    // see codec example for why codec is required
    implicit val codec = Codec.UTF8

    val url:Input = fromURLString("file://someFile")

    // by default the line terminator is stripped and is
    // auto detected
    url.lines() foreach println _

    // now do not strip terminator
    url.lines (includeTerminator = true) foreach print _

    // now declare explicitly the terminator
    // terminator is restricted to 1 or 2 characters
    url.lines (terminator = Line.Terminators.NewLine) foreach println _