Package net.glowstone.net.codec.play.game

Source Code of net.glowstone.net.codec.play.game.PingCodec

package net.glowstone.net.codec.play.game;

import com.flowpowered.networking.Codec;
import com.flowpowered.networking.util.ByteBufUtils;
import io.netty.buffer.ByteBuf;
import net.glowstone.net.message.play.game.PingMessage;

import java.io.IOException;

public final class PingCodec implements Codec<PingMessage> {
    @Override
    public PingMessage decode(ByteBuf buffer) throws IOException {
        return new PingMessage(ByteBufUtils.readVarInt(buffer));
    }

    @Override
    public ByteBuf encode(ByteBuf buf, PingMessage message) throws IOException {
        ByteBufUtils.writeVarInt(buf, message.getPingId());
        return buf;
    }
}
TOP

Related Classes of net.glowstone.net.codec.play.game.PingCodec

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.