func (stream *ByteStream) SetCapacity(capacity int) {
	if stream.Cap() < capacity {
		current := stream.data
		stream.data = make([]byte, capacity)
		if stream.writeOffset > 0 {
			copy(stream.data, current[:stream.writeOffset])
		}
	}
}
SetCapacity assures that capacity bytes are available in the buffer, growing
the managed byte array if needed. The buffer will grow by at least 64 bytes
if growing is required.
package tio
import "io"
type ByteStream struct {
	data        []byte
	writeOffset int
	readOffset  int
}
func NewByteStream(capacity int) ByteStream {
	return ByteStream{
		data:        make([]byte, capacity),
		writeOffset: 0,
	}
}
func NewByteStreamFrom(data []byte) ByteStream {
	return ByteStream{
		data:        data,
		writeOffset: len(data),
	}
}