In what way exactly?
There are 2 answers I can see.
1. THe Java input stream way where each byte is converted to an integer
2. The "correct" way where you take 4 bytes and convert it to an integer
Both ways are supported by scala-io.
The first would be:
input.bytesAsInts.foreach(i => // do something with integer)
For the second the solution is not as neat as for writing and it should be :( I will work on that.
// convert to a LongTraversable[Int]
val integerTraversable = for {
// ByteProcessor creates ints and longs in Big-Endian but you can
// convert it to an implementation to parse in Little-Endian
processor <- ByteProcessor(input.bytes.processor)
// call this so you process the entire input rather than just grab
// first integer
_ <- processor.repeatUntilEmpty
} yield {
processor.nextInt
}
integerTraversable.foreach( i => // do something with integer)
As with your last email. It is clear to me this can be improved so I am creating a ticket about the verbosity of this fairly normal case.
Jesse