grib/src/main/java/ucar/nc2/grib/grib1/tables/Grib1ParamTableReader.java
private Map<Integer, Grib1Parameter> readParameterTableSplit(String regexp, int[] order)
      throws IOException {
    HashMap<Integer, Grib1Parameter> result = new HashMap<>();

    try (InputStream is = GribResourceReader.getInputStream(path);
        BufferedReader br = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {

      // rdg - added the 0 line length check to cover the case of blank lines at the end of the parameter table file.
      while (true) {
        String line = br.readLine();
        if (line == null) {
          break;
        }
        if ((line.length() == 0) || line.startsWith("#")) {
          continue;
        }
        String[] flds = line.split(regexp);

        int p1 = Integer.parseInt(flds[order[0]].trim()); // must have a number
        String name = (order[1] >= 0) ? flds[order[1]].trim() : null;
        String desc = flds[order[2]].trim();
        String units = (flds.length > order[3]) ? flds[order[3]].trim() : "";

        Grib1Parameter parameter = new Grib1Parameter(this, p1, name, desc, units);
        result.put(parameter.getNumber(), parameter);
        logger.debug(" %s%n", parameter);
      }
      return Collections.unmodifiableMap(result);  // all at once - thread safe
    }

  }
private Map<Integer, Grib1Parameter> readParameterTableSplit(String regexp, int[] order)
      throws IOException {
    HashMap<Integer, Grib1Parameter> result = new HashMap<>();

    try (InputStream is = GribResourceReader.getInputStream(path);
        BufferedReader br = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {

      // rdg - added the 0 line length check to cover the case of blank lines at the end of the parameter table file.
      while (true) {
        String line = br.readLine();
        if (line == null) {
          break;
        }
        if ((line.length() == 0) || line.startsWith("#")) {
          continue;
        }
        String[] flds = line.split(regexp);

        int p1 = Integer.parseInt(flds[order[0]].trim()); // must have a number
        String name = (order[1] >= 0) ? flds[order[1]].trim() : null;
        String desc = flds[order[2]].trim();
        String units = (flds.length > order[3]) ? flds[order[3]].trim() : "";

        Grib1Parameter parameter = new Grib1Parameter(this, p1, name, desc, units);
        result.put(parameter.getNumber(), parameter);
        logger.debug(" %s%n", parameter);
      }
      return Collections.unmodifiableMap(result);  // all at once - thread safe
    }

  }
private Map < Integer , Grib1Parameter > readParameterTableSplit ( String regexp , int [ ] order ) throws IOException { HashMap < Integer , Grib1Parameter > result = new HashMap <> ( ) ; try ( InputStream is = GribResourceReader . getInputStream ( path ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( is , StandardCharsets . UTF_8 ) ) ) { // rdg - added the 0 line length check to cover the case of blank lines at the end of the parameter table file. while ( true ) { String line = br . readLine ( ) ; if ( line == null ) { break ; } if ( ( line . length ( ) == 0 ) || line . startsWith ( "#" ) ) { continue ; } String [ ] flds = line . split ( regexp ) ; int p1 = Integer . parseInt ( flds [ order [ 0 ] ] . trim ( ) ) ; // must have a number String name = ( order [ 1 ] >= 0 ) ? flds [ order [ 1 ] ] . trim ( ) : null ; String desc = flds [ order [ 2 ] ] . trim ( ) ; String units = ( flds . length > order [ 3 ] ) ? flds [ order [ 3 ] ] . trim ( ) : "" ; Grib1Parameter parameter = new Grib1Parameter ( this , p1 , name , desc , units ) ; result . put ( parameter . getNumber ( ) , parameter ) ; logger . debug ( " %s%n" , parameter ) ; } return Collections . unmodifiableMap ( result ) ; // all at once - thread safe } }
order: num, name, desc, unit
order : num name desc unit