public Message copy(boolean copy_buffer) { Message retval=new Message(); retval.dest_addr=dest_addr; retval.src_addr=src_addr;  if(copy_buffer && buf != null) {   retval.setBuffer(buf, offset, length);    }  if(headers != null) retval.headers=(HashMap)headers.clone(); return retval;
public Message copy() { return copy(true);
    public Message copy(boolean copy_buffer) {        Message retval=new Message();        retval.dest_addr=dest_addr;        retval.src_addr=src_addr;        if(copy_buffer && buf != null) {            // change bela Feb 26 2004: we don't resolve the reference            retval.setBuffer(buf, offset, length);            /*            byte[] new_buf;            if(offset > 0 || length != buf.length) { // resolve reference to subset by copying subset into new buffer                new_buf=new byte[length];                System.arraycopy(buf, offset, new_buf, 0, length);            }            else                new_buf=buf;            retval.setBuffer(new_buf);            */        }        if(headers != null)            retval.headers=(HashMap)headers.clone();        return retval;    }