All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.pkts.packet.sip.header.impl.ContactHeaderImpl Maven / Gradle / Ivy

There is a newer version: 3.0.10
Show newest version
/**
 * 
 */
package io.pkts.packet.sip.header.impl;

import io.pkts.buffer.Buffer;
import io.pkts.packet.sip.address.Address;
import io.pkts.packet.sip.header.ContactHeader;


/**
 * @author [email protected]
 */
public class ContactHeaderImpl extends AddressParametersHeaderImpl implements ContactHeader {

    /**
     * @param name
     * @param address
     * @param params
     */
    public ContactHeaderImpl(final Buffer value, final Address address, final Buffer params) {
        super(ContactHeader.NAME, value, address, params);
    }

    @Override
    public ContactHeader clone() {
        final Buffer value = getValue();
        final Address address = getAddress();
        final Buffer params = getRawParams();
        // TODO: once Buffer is truly immutable we don't actually have to clone, like we don't have to do for Address anymore
        return new ContactHeaderImpl(value.clone(), address, params.clone());
    }

    @Override
    public ContactHeader.Builder copy() {
        final ContactHeader.Builder builder = ContactHeader.withAddress(getAddress());
        builder.withParameters(getRawParams().slice());
        return builder;
    }

    @Override
    public ContactHeader ensure() {
        return this;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy