Package org.hxzon.netprotocol.payload

Source Code of org.hxzon.netprotocol.payload.DataPayload

package org.hxzon.netprotocol.payload;

import org.hxzon.netprotocol.common.IPacket;
import org.hxzon.netprotocol.common.IPacketPayload;
import org.hxzon.netprotocol.common.PacketGroup;
import org.hxzon.netprotocol.common.PayloadHelper;

public class DataPayload extends PayloadHelper implements IPacketPayload {
    private PacketGroup<?> _group;

    public PacketGroup<?> getGroup() {
        return _group;
    }

    public void setGroup(PacketGroup<?> group) {
        this._group = group;
    }

    public String getProtocolTypeDesc() {
        if (_group != null) {
            IPacketPayload payload = _group.getPayload();
            if (payload != null) {
                if (payload instanceof IPacket) {
                    payload = ((IPacket) payload).getLastPayload();
                }
                return payload.getProtocolTypeDesc();
            }
        }
        return getSrcPacket().getProtocolTypeDesc();
    }

    public String getName() {
        return "user data";
    }

}
TOP

Related Classes of org.hxzon.netprotocol.payload.DataPayload

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.