visad/src/main/java/ucar/nc2/iosp/gempak/GempakGridReader.java
private Grib2Record makeGribRecord(RandomAccessFile raf, long start) throws IOException {
    Grib2SectionIndicator is = new Grib2SectionIndicator(start, 0, 0); // apparently not in GEMPAK file (!)

    Grib2SectionIdentification ids = null;
    Grib2SectionLocalUse lus = null;
    Grib2SectionGridDefinition gds = null;
    Grib2SectionProductDefinition pds = null;
    Grib2SectionDataRepresentation drs = null;
    Grib2SectionBitMap bms = null;
    Grib2SectionData dataSection = null;

    raf.seek(start);
    raf.order(RandomAccessFile.BIG_ENDIAN);

    int secLength = raf.readInt();
    if (secLength > 0) {
      ids = new Grib2SectionIdentification(raf);
    }

    secLength = raf.readInt();
    if (secLength > 0) {
      lus = new Grib2SectionLocalUse(raf);
    }

    secLength = raf.readInt();
    if (secLength > 0) {
      gds = new Grib2SectionGridDefinition(raf);
    }

    secLength = raf.readInt();
    if (secLength > 0) {
      pds = new Grib2SectionProductDefinition(raf);
    }

    secLength = raf.readInt();
    if (secLength > 0) {
      drs = new Grib2SectionDataRepresentation(raf);
    }

    secLength = raf.readInt();
    if (secLength > 0) {
      bms = new Grib2SectionBitMap(raf);
    }

    secLength = raf.readInt();
    if (secLength > 0) {
      dataSection = new Grib2SectionData(raf);
      if (dataSection.getMsgLength() > secLength)  // presumably corrupt
        throw new IllegalStateException("Illegal Grib2SectionData Message Length");
    }

    // LOOK - not dealing with repeated records
    return new Grib2Record(null, is, ids, lus, gds, pds, drs, bms, dataSection, false, Grib2Index.ScanModeMissing);
  }
private Grib2Record makeGribRecord(RandomAccessFile raf, long start) throws IOException {
    Grib2SectionIndicator is = new Grib2SectionIndicator(start, 0, 0); // apparently not in GEMPAK file (!)

    Grib2SectionIdentification ids = null;
    Grib2SectionLocalUse lus = null;
    Grib2SectionGridDefinition gds = null;
    Grib2SectionProductDefinition pds = null;
    Grib2SectionDataRepresentation drs = null;
    Grib2SectionBitMap bms = null;
    Grib2SectionData dataSection = null;

    raf.seek(start);
    raf.order(RandomAccessFile.BIG_ENDIAN);

    int secLength = raf.readInt();
    if (secLength > 0) {
      ids = new Grib2SectionIdentification(raf);
    }

    secLength = raf.readInt();
    if (secLength > 0) {
      lus = new Grib2SectionLocalUse(raf);
    }

    secLength = raf.readInt();
    if (secLength > 0) {
      gds = new Grib2SectionGridDefinition(raf);
    }

    secLength = raf.readInt();
    if (secLength > 0) {
      pds = new Grib2SectionProductDefinition(raf);
    }

    secLength = raf.readInt();
    if (secLength > 0) {
      drs = new Grib2SectionDataRepresentation(raf);
    }

    secLength = raf.readInt();
    if (secLength > 0) {
      bms = new Grib2SectionBitMap(raf);
    }

    secLength = raf.readInt();
    if (secLength > 0) {
      dataSection = new Grib2SectionData(raf);
      if (dataSection.getMsgLength() > secLength)  // presumably corrupt
        throw new IllegalStateException("Illegal Grib2SectionData Message Length");
    }

    // LOOK - not dealing with repeated records
    return new Grib2Record(null, is, ids, lus, gds, pds, drs, bms, dataSection, false, Grib2Index.ScanModeMissing);
  }
for GempakGridReader