Basic Read Write

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

Add All Bytes

add all bytes in stream together
    import scalax.io._
    import java.io.InputStream
    import java.net.URL

    // see codec examples in scala io core for details on why there is an implicit codec here
    implicit val codec = scalax.io.Codec.UTF8

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

    // Actual type is InputStreamResource[InputStream] but that is only needed if you want to convert to a reader
    val url2: InputStreamResource[InputStream] = Resource.fromURLString("file://someFile")
    val sum: Int = url.bytesAsInts.reduceLeft (_ + _)