Exemple #1
0
  /**
   * Create a copy of the message. If offset and length are used (to refer to another buffer), the
   * copy will contain only the subset offset and length point to, copying the subset into the new
   * copy.
   *
   * @param copy_buffer
   * @param copy_headers Copy the headers
   * @return Message with specified data
   */
  public Message copy(boolean copy_buffer, boolean copy_headers) {
    Message retval = new Message(false);
    retval.dest_addr = dest_addr;
    retval.src_addr = src_addr;
    retval.flags = flags;

    if (copy_buffer && buf != null) {

      // change bela Feb 26 2004: we don't resolve the reference
      retval.setBuffer(buf, offset, length);
    }

    retval.headers = copy_headers ? createHeaders(headers) : createHeaders(3);
    return retval;
  }