コード例 #1
0
        protected void expandCapacity(int minCapacity)
        {
            int newCapacity = 2 * this.capacity;

            // If the new capacity overflows the range of 32-bit integers, then use the largest 32-bit integer.
            if (newCapacity < 0)
            {
                newCapacity = Integer.MAX_VALUE;
            }
            // If the new capacity is still not large enough for the minimum capacity specified, then just use the minimum
            // capacity specified.
            else if (newCapacity < minCapacity)
            {
                newCapacity = minCapacity;
            }

            this.offsets  = WWBufferUtil.copyOf(this.offsets, newCapacity);
            this.lengths  = WWBufferUtil.copyOf(this.lengths, newCapacity);
            this.capacity = newCapacity;
        }