visad/src/main/java/ucar/nc2/iosp/gempak/GempakFileReader.java
public float[] getFileHeader(String name) throws IOException {
    DMFileHeaderInfo fh = findFileHeader(name);
    if ((fh == null) || (fh.kfhtyp != MDREAL)) {
      return null;
    }
    int knt = fileHeaderInfo.indexOf(fh);  // 0 based
    int iread = dmLabel.kpfile + 3 * dmLabel.kfhdrs;
    for (int i = 0; i < knt; i++) {
      DMFileHeaderInfo fhi = fileHeaderInfo.get(i);
      iread = iread + fhi.kfhlen + 1;
    }
    int nword = DM_RINT(iread);
    if (nword <= 0) {
      logError("Invalid header length for " + name);
      return null;
    }
    iread++;
    float[] rheader = new float[nword];
    if (name.equals("NAVB") && needToSwap) {
      DM_RFLT(iread, 1, rheader, 0);
      needToSwap = false;
      iread++;
      DM_RFLT(iread, 1, rheader, 1);
      needToSwap = true;
      iread++;
      DM_RFLT(iread, nword - 2, rheader, 2);

    } else {
      DM_RFLT(iread, rheader);
    }
    return rheader;
  }
public float[] getFileHeader(String name) throws IOException {
    DMFileHeaderInfo fh = findFileHeader(name);
    if ((fh == null) || (fh.kfhtyp != MDREAL)) {
      return null;
    }
    int knt = fileHeaderInfo.indexOf(fh);  // 0 based
    int iread = dmLabel.kpfile + 3 * dmLabel.kfhdrs;
    for (int i = 0; i < knt; i++) {
      DMFileHeaderInfo fhi = fileHeaderInfo.get(i);
      iread = iread + fhi.kfhlen + 1;
    }
    int nword = DM_RINT(iread);
    if (nword <= 0) {
      logError("Invalid header length for " + name);
      return null;
    }
    iread++;
    float[] rheader = new float[nword];
    if (name.equals("NAVB") && needToSwap) {
      DM_RFLT(iread, 1, rheader, 0);
      needToSwap = false;
      iread++;
      DM_RFLT(iread, 1, rheader, 1);
      needToSwap = true;
      iread++;
      DM_RFLT(iread, nword - 2, rheader, 2);

    } else {
      DM_RFLT(iread, rheader);
    }
    return rheader;
  }
public float [ ] getFileHeader ( String name ) throws IOException { DMFileHeaderInfo fh = findFileHeader ( name ) ; if ( ( fh == null ) || ( fh . kfhtyp != MDREAL ) ) { return null ; } int knt = fileHeaderInfo . indexOf ( fh ) ; // 0 based int iread = dmLabel . kpfile + 3 * dmLabel . kfhdrs ; for ( int i = 0 ; i < knt ; i ++ ) { DMFileHeaderInfo fhi = fileHeaderInfo . get ( i ) ; iread = iread + fhi . kfhlen + 1 ; } int nword = DM_RINT ( iread ) ; if ( nword <= 0 ) { logError ( "Invalid header length for " + name ) ; return null ; } iread ++ ; float [ ] rheader = new float [ nword ] ; if ( name . equals ( "NAVB" ) && needToSwap ) { DM_RFLT ( iread , 1 , rheader , 0 ) ; needToSwap = false ; iread ++ ; DM_RFLT ( iread , 1 , rheader , 1 ) ; needToSwap = true ; iread ++ ; DM_RFLT ( iread , nword - 2 , rheader , 2 ) ; } else { DM_RFLT ( iread , rheader ) ; } return rheader ; }
Read in the values for the file header

@param name name of header
@return values or null if not found
@throws IOException problem reading file
Read in the values for the file header