Access Segment Of Input

Examples for reading sections of an Input object without reading all data in the underlying resource

Putting It Together

An example with drop take and limitFold.

    import scalax.io._

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

    /**
     * Skip first 10 bytes and sum a random number of bytes up
     * to 20 bytes
     */
    in.bytes.drop(10).take(20).limitFold(10) {
      case (acc, next) if util.Random.nextBoolean => End(acc + next)
      case (acc, next) => End(acc + next)
    }