Code example for DataInput

Methods: readFully, readInt, readShort, readUTF

0
		type = Packet.RECONNECT; 
	} 
	 
	@Override 
	public void parseFromDataInput(DataInput in) throws IOException {
		name = in.readUTF();
		host = in.readUTF();
		port = in.readInt();
		gameId = in.readInt();
		keyTime = in.readInt();
		int size = in.readShort();
		key = new byte[size];
		in.readFully(key);
	} 
	 
	@Override 
	public void writeToDataOutput(DataOutput out) throws IOException {
		out.writeUTF(name);
		out.writeUTF(host);
		out.writeInt(port);
		out.writeInt(gameId);