Val,
The code looks good to me. The only place that made me wonder was out.unsafeEnsure(1 + 4) call which extends the stream by 5 bytes, however we can write significantly more bytes. I see that we use the same approach in other places, so I was wondering if this is a required call or a performance hint?
