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

net.sf.jrtps.message.parameter.QosGroupData Maven / Gradle / Ivy

There is a newer version: 1.5.1
Show newest version
package net.sf.jrtps.message.parameter;

import net.sf.jrtps.transport.RTPSByteBuffer;

public class QosGroupData extends Parameter implements SubscriberPolicy, PublisherPolicy {
	private byte[] groupData;

	public QosGroupData(byte[] groupData) {
        super(ParameterEnum.PID_GROUP_DATA);
        if (groupData == null) {
        	throw new NullPointerException("groupData cannot be null");
        }
        
		this.groupData = groupData;
    }
	
	QosGroupData() {
        super(ParameterEnum.PID_GROUP_DATA);
    }

    @Override
    public void read(RTPSByteBuffer bb, int length) {
    	int len = bb.read_long();
    	this.groupData = new byte[len];
    	bb.read(groupData);
    }

    @Override
    public void writeTo(RTPSByteBuffer bb) {
       	bb.write_long(groupData.length);
    	bb.write(groupData);
     }

    @Override
    public boolean isCompatible(QosGroupData other) {
        return true; // Always true
    }

    public static QosGroupData defaultGroupData() {
        return new QosGroupData(new byte[0]);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy