Make sure buffer is offset correctly when written to stream in REST.java

Make sure we offset the buffer write with the number of bytes read from the input. 

I'm confused as to how this seems to work at the moment. Are we just lucky?