Optimize ResourceInputStream

I'm adding the overrides in native.js because I think it's better to have all the ResourceInputStream in the same place, but I may be convinced otherwise.