//Implement a class IterableInputStream that extends java.io.InputStream with the trait Iterable[Byte] .
class IterableInputStram(is: InputStream) extends InputStream with Iterable[Byte] { override def iterator = new Iterator[Byte] { override def hasNext = is.available > 0 override def next = { is.read.toByte } } def read = is.read } val bi = new IterableInputStram(new FileInputStream("c:/ObjectTest.obj")).iterator val r = bi.map(_.toChar).mkString println(r)