-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Description
The following code results in evaluation of the whole file:
scala> import collection.immutable.PagedSeq
scala> val in = new java.io.StringReader("t"*10000){override def read(c:Array[Char],o:Int,l:Int)={println("Read: "+l);super.read(c,o,l)}}
scala> PagedSeq.fromReader(in).slice(0,2).mkString
Read: 4096
Read: 4096
Read: 4096
Read: 2288I think this shouldn't be happening, since I am actually requesting only 2 characters from the input, not the whole file. Same thing happens if I call .toList on that slice.
Also what troubles me is that total of 14576 characters is read (4096*3+2288), while it should be exactly 10000 (length of the string).