public JdpPacketReader(byte[] packet) throws JdpException {
  ByteArrayInputStream bais=new ByteArrayInputStream(packet);
  pkt=new DataInputStream(bais);
  try {
    int magic=pkt.readInt();
    JdpGenericPacket.checkMagic(magic);
  }
 catch (  IOException e) {
    throw new JdpException("Invalid JDP packet received, bad magic");
  }
  try {
    short version=pkt.readShort();
    JdpGenericPacket.checkVersion(version);
  }
 catch (  IOException e) {
    throw new JdpException("Invalid JDP packet received, bad protocol version");
  }
}

public JdpPacketReader ( byte [ ] packet ) throws JdpException { ByteArrayInputStream bais = new ByteArrayInputStream ( packet ) ; pkt = new DataInputStream ( bais ) ; try { int magic = pkt . readInt ( ) ; JdpGenericPacket . checkMagic ( magic ) ; } catch ( IOException e ) { throw new JdpException ( "Invalid JDP packet received, bad magic" ) ; } try { short version = pkt . readShort ( ) ; JdpGenericPacket . checkVersion ( version ) ; } catch ( IOException e ) { throw new JdpException ( "Invalid JDP packet received, bad protocol version" ) ; } }
create packet reader , extract and check magic and version
