Implement essential classes of java.io

We might want a `while` loop, here. With the benchmarks I've discovered that a for-range loop with a very small number of iterations was killing performance.