/** * Ensure that path is capable to hold at least {@code capacity} bytes * * @param capacity the amount of bytes to hold * @param len the amount of live bytes in path buffer */ protected void ensurePathCapacity(final int capacity, final int len) { if (path.length >= capacity) return; final byte[] o = path; int current = o.length; int newCapacity = current; while (newCapacity < capacity && newCapacity > 0) newCapacity <<= 1; setPathCapacity(newCapacity, len); }
/** * Grow the path buffer larger. * * @param len number of live bytes in the path buffer. This many bytes will be moved into the * larger buffer. */ protected void growPath(final int len) { setPathCapacity(path.length << 1, len); }