// 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.
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.
// 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 .
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])
		}
	}
}
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.
SetCapacity assures that capacity bytes are available in the buffer growing the managed byte array if needed .