public static int encodingNum(String name) {
    if (name.equalsIgnoreCase("Raw"))      return encodingRaw;
    if (name.equalsIgnoreCase("CopyRect")) return encodingCopyRect;
    if (name.equalsIgnoreCase("RRE"))      return encodingRRE;
    if (name.equalsIgnoreCase("CoRRE"))    return encodingCoRRE;
    if (name.equalsIgnoreCase("Hextile"))  return encodingHextile;
    if (name.equalsIgnoreCase("Tight"))    return encodingTight;
    if (name.equalsIgnoreCase("ZRLE"))     return encodingZRLE;
    return -1;
  }