Code example for DataInput

Methods: readByte, readShort

0
        this.ping = i;
    } 
 
    public void readPacketData(DataInput datainput)
    { 
        this.playerName = readString(datainput, 16);
        this.isConnected = datainput.readByte() != 0;
        this.ping = datainput.readShort();
    } 
 
    public void writePacketData(DataOutput dataoutput)
    { 
        writeString(this.playerName, dataoutput);
        dataoutput.writeByte(this.isConnected ? 1 : 0);
        dataoutput.writeShort(this.ping);
    } 
 
    public void processPacket(NetHandler connection)
    { 
        connection.handlePlayerInfo(this);
    }