// 7/1/10 M. Brenner import java.io.*; // To add a new type of Packet: // // 1) areate a new subclass of APacket // 2) add another case in APacket.makepacket() // public class APacket extends Packet { static public final int PACKETMARK = 100; /** * Factory for creating packets given a data Channel */ public Packet makepacket (Channel channel) { int type; Packet packet; packet = null; try { type = channel.read(); //Log.print ("APacket.makepacket() type: " + type); switch (type) { case PACKETMARK: packet = new Packetmark (channel); break; default: //Log.print ("Apacket.makepacket() not an app packet"); packet = makepacket (type, channel); break; } } catch (IOException e) { Services.oops ("Packet.makepacket()", e); } return packet; } public APacket() {} public APacket (int channelto) { super (channelto); } public APacket (Channel channel) throws IOException { super (channel); } public void docommand() { } public byte[] tobuffer() { return new byte[0]; } }