How about:
Stream.continually(is.read).takeWhile(_ != -1).map(_.toByte).toArray
Update: use LazyList instead of Stream
(since Stream
is deprecated in Scala 3)
LazyList.continually(is.read).takeWhile(_ != -1).map(_.toByte).toArray
How about:
Stream.continually(is.read).takeWhile(_ != -1).map(_.toByte).toArray
Update: use LazyList instead of Stream
(since Stream
is deprecated in Scala 3)
LazyList.continually(is.read).takeWhile(_ != -1).map(_.toByte).toArray