public BytesWriteStream(int size) { _buf = new byte[MathUtils.getPowerOf2(size)]; _length = 0; _position = 0; _canGrow = true; }
protected int countCapacity(int capacity) { capacity = MathUtils.getPowerOf2(capacity); if (capacity < _minSize) { capacity = _minSize; } return(capacity); }
private void grow(int len) { int cap = MathUtils.getPowerOf2(len); if (cap > _buf.Length) { byte[] bs = new byte[cap]; Buffer.BlockCopy(_buf, 0, bs, 0, _buf.Length); _buf = bs; } }