code: private void modifyEnsure(int ahead) {
          if (isShared()) {
              int len = (end - p) + ahead;
              byte[]tmp = new byte[len + NODE_STR_MARGIN];
              System.arraycopy(bytes, p, tmp, 0, end - p);
              bytes = tmp;
              end = end - p;
              p = 0;
              clearShared();
          } else {
              ensure(ahead);
          }
      }
docs: /* COW and/or ensure there is ahead bytes available in node's buffer