Optimize ByteArrayInputStream

This saves a few seconds at startup. It's also used a lot in general, so it's worth implementing it in JS.
Hmm, I don't think len can be < 0 at this point, although it could be == 0.