FileDocCategorySizeDatePackage
PlayerRecord.javaAPI DocExample935Tue Dec 12 18:58:44 GMT 2000bingo.shared

PlayerRecord

public class PlayerRecord extends Object

Fields Summary
public int
ID
public String
name
public int
numCards
public int
wolfCries
Constructors Summary
public PlayerRecord(int ID, String name, int numCards)


           

	this.ID = ID;
	this.name = name;
	this.numCards = numCards;

	this.wolfCries = 0;
    
public PlayerRecord(byte[] b)

	this.ID = (int)b[0];
	this.numCards = (int)b[1];
	this.wolfCries = (int)b[2];

	byte[] nameBytes = new byte[b.length-3];
	System.arraycopy(b, 3, nameBytes, 0, nameBytes.length);
	this.name = new String(nameBytes);
    
Methods Summary
public byte[]getBytes()

        byte[] numbers = { (byte)ID, (byte)numCards, (byte)wolfCries };
	byte[] nameBytes = name.getBytes();

	byte[] answer = new byte[numbers.length + nameBytes.length];

	System.arraycopy(numbers, 0, answer, 0, numbers.length);
	System.arraycopy(nameBytes, 0,
			 answer, numbers.length, nameBytes.length);

	return answer;