code: public void grow(int delta) {
          if (delta == 0) {
              return;
          }
          int newLen = buffer.limit()+delta; 
          if (newLen <= buffer.capacity()) {
          	// there is more room in the underlying reserved buffer memory 
          	buffer.limit(newLen);
          	return;
          } else {
          	// create a new bigger buffer
              ByteBuffer newBuffer = buffer.isDirect() ? ByteBuffer.allocateDirect(newLen) : ByteBuffer.allocate(newLen);
              buffer.rewind();
              newBuffer.put(buffer);
              newBuffer.limit(newLen);
              // switch to new buffer
              buffer = newBuffer;
          }
      }
docs: Grow the internal packet buffer.
  
  This will change the data buffer of this packet but not the
  length of the valid data. Use this to grow the internal buffer
  to avoid buffer re-allocations when appending data.
  
  @param delta number of bytes to grow