catch (IOException ex) { ex.printStackTrace();  throw new EntityLoadingException("I/O Error reading file");  } }
  public HmpFile(InputStream is)/* OMIT_FOR_JHMPREAD_COMPILATION BLOCK_BEGIN */      throws EntityLoadingException/* BLOCK_END */  {    try    {      DataInputStream dis = new DataInputStream(is);      byte[] buffer = new byte[5];      dis.read(buffer);      String version = new String(buffer);      // this next one no longer seems accurate...      DesignType designType =          DesignType.getType(readUnsignedByte(dis));      // ??      dis.skipBytes(3);      // some flags saying which Clans use this design      dis.skipBytes(3);      // ??      dis.skipBytes(1);      // some flags saying which Inner Sphere factions use this design      dis.skipBytes(3);      // ??      dis.skipBytes(1);      tonnage = readUnsignedShort(dis);      buffer = new byte[readUnsignedShort(dis)];      dis.read(buffer);      name = new String(buffer);      buffer = new byte[readUnsignedShort(dis)];      dis.read(buffer);      model = new String(buffer);      year = readUnsignedShort(dis);      rulesLevel = readUnsignedShort(dis);      long cost = readUnsignedInt(dis);      // ??      dis.skipBytes(22);      // section with BF2 stuff      int bf2Length = readUnsignedShort(dis);      dis.skipBytes(bf2Length);      techType = TechType.getType(readUnsignedShort(dis));      if (techType == TechType.MIXED) {          // We've got a total of 7 shorts here.          // The first one is the mech's "base" chassis technology type.          //  It also doubles as the internal structure type.          mixedBaseTechType = TechType.getType(readUnsignedShort(dis));          // Next we have engine, heat sinks, physical attack weapon,          //  myomer, targeting computer, and finally armor.  Note that          //  these 14 bytes are always present in mixed-tech designs,          //  whether the specific equipment exists on the mech or not.          engineTechType = TechType.getType(readUnsignedShort(dis));          heatSinkTechType = TechType.getType(readUnsignedShort(dis));          physicalWeaponTechType = TechType.getType(readUnsignedShort(dis));          myomerTechType = TechType.getType(readUnsignedShort(dis));          targetingComputerTechType = TechType.getType(readUnsignedShort(dis));          armorTechType = TechType.getType(readUnsignedShort(dis));      }      chassisType = ChassisType.getType(readUnsignedShort(dis));      internalStructureType =        InternalStructureType.getType(readUnsignedShort(dis));      engineRating = readUnsignedShort(dis);      engineType = EngineType.getType(readUnsignedShort(dis));      walkMP = readUnsignedShort(dis);      jumpMP = readUnsignedShort(dis);      heatSinks = readUnsignedShort(dis);      heatSinkType = HeatSinkType.getType(readUnsignedShort(dis));      armorType = ArmorType.getType(readUnsignedShort(dis));      if (armorType == ArmorType.PATCHWORK) {          laArmorType = ArmorType.getType(readUnsignedShort(dis));          ltArmorType = ArmorType.getType(readUnsignedShort(dis));          llArmorType = ArmorType.getType(readUnsignedShort(dis));          raArmorType = ArmorType.getType(readUnsignedShort(dis));          rtArmorType = ArmorType.getType(readUnsignedShort(dis));          rlArmorType = ArmorType.getType(readUnsignedShort(dis));          headArmorType = ArmorType.getType(readUnsignedShort(dis));          ctArmorType = ArmorType.getType(readUnsignedShort(dis));          ltrArmorType = ArmorType.getType(readUnsignedShort(dis));          rtrArmorType = ArmorType.getType(readUnsignedShort(dis));          ctrArmorType = ArmorType.getType(readUnsignedShort(dis));      }      dis.skipBytes(2); // ??      laArmor = readUnsignedShort(dis);      dis.skipBytes(4); // ??      ltArmor = readUnsignedShort(dis);      dis.skipBytes(4); // ??      llArmor = readUnsignedShort(dis);      dis.skipBytes(4); // ??      raArmor = readUnsignedShort(dis);      dis.skipBytes(4); // ??      rtArmor = readUnsignedShort(dis);      dis.skipBytes(2); // ??      jjType = readUnsignedShort(dis);      rlArmor = readUnsignedShort(dis);      dis.skipBytes(4); // ??      headArmor = readUnsignedShort(dis);      dis.skipBytes(4); // ??      ctArmor = readUnsignedShort(dis);      dis.skipBytes(2); // ??      ltrArmor = readUnsignedShort(dis);      rtrArmor = readUnsignedShort(dis);      ctrArmor = readUnsignedShort(dis);      myomerType =          MyomerType.getType(readUnsignedShort(dis));      totalWeaponCount = readUnsignedShort(dis);      weaponArray = new int[totalWeaponCount][4];      for (int i = 0; i < totalWeaponCount; i++)      {          weaponArray[i][0] = readUnsignedShort(dis); //weapon count          weaponArray[i][1] = readUnsignedShort(dis); //weapon type          weaponArray[i][2] = readUnsignedShort(dis); //weapon location          weaponArray[i][3] = readUnsignedShort(dis); //ammo          dis.skipBytes(2); // ??          // manufacturer name          dis.skipBytes(readUnsignedShort(dis));      }      // left arm criticals      for(int x = 0; x < 12; x++)      {        laCriticals[x] = readUnsignedInt(dis);      }           // left torso criticals      for(int x = 0; x < 12; x++)      {        ltCriticals[x] = readUnsignedInt(dis);      }           // left leg criticals      for(int x = 0; x < 12; x++)      {        llCriticals[x] = readUnsignedInt(dis);      }           // right arm criticals      for(int x = 0; x < 12; x++)      {        raCriticals[x] = readUnsignedInt(dis);      }           // right torso criticals      for(int x = 0; x < 12; x++)      {        rtCriticals[x] = readUnsignedInt(dis);      }           // right leg criticals      for(int x = 0; x < 12; x++)      {        rlCriticals[x] = readUnsignedInt(dis);      }           // head criticals      for(int x = 0; x < 12; x++)      {        headCriticals[x] = readUnsignedInt(dis);      }           // center torso criticals      for(int x = 0; x < 12; x++)      {        ctCriticals[x] = readUnsignedInt(dis);      }           dis.skipBytes(4);      int fluffSize = 0;      fluff = "Overview:\n\r";      buffer = new byte[readUnsignedShort(dis)];      dis.read(buffer);      fluff += new String(buffer);      fluffSize += new String(buffer).length();            fluff += "\n\rCapability:\n\r";      buffer = new byte[readUnsignedShort(dis)];      dis.read(buffer);      fluff += new String(buffer);      fluffSize += new String(buffer).length();      fluff += "\n\rBattle History:\n\r";      buffer = new byte[readUnsignedShort(dis)];      dis.read(buffer);      fluff += new String(buffer);      fluffSize += new String(buffer).length();      fluff += "\n\rVariants:\n\r";      buffer = new byte[readUnsignedShort(dis)];      dis.read(buffer);      fluff += new String(buffer);      fluffSize += new String(buffer).length();      fluff += "\n\rFamous Mechs and Warriors:\n\r";      buffer = new byte[readUnsignedShort(dis)];      dis.read(buffer);      fluff += new String(buffer);      fluffSize += new String(buffer).length();      fluff += "\n\rDeployment:\n\r";      buffer = new byte[readUnsignedShort(dis)];      dis.read(buffer);      fluff += new String(buffer);      fluffSize += new String(buffer).length();      //just a catch all for small Fluffs anything well less then 10 characters, per section, isn't worth printing.      if ( fluffSize <= 60 )          fluff = null;      //non printing notes      dis.skipBytes(readUnsignedShort(dis));      dis.skipBytes(readUnsignedShort(dis));      dis.skipBytes(8); // mechs with supercharger have an 01 in here, but we can identify from the criticals            // Get cockpit and gyro type, if any.        if (rulesLevel > 2) {            gyroType = readUnsignedShort(dis);            cockpitType = readUnsignedShort(dis);            dis.skipBytes(16);            targSys = readUnsignedShort(dis);        } else {            gyroType = Mech.GYRO_STANDARD;            cockpitType = Mech.COCKPIT_STANDARD;        }      dis.close();    }    catch (IOException ex)    {        ex.printStackTrace();/* OMIT_FOR_JHMPREAD_COMPILATION BLOCK_BEGIN */        throw new EntityLoadingException("I/O Error reading file");/* BLOCK_END */    }  }