cdm/src/main/java/ucar/nc2/iosp/misc/Uspln.java
int readAllData(RandomAccessFile raf)
          throws IOException, NumberFormatException, ParseException {
    ArrayList offsetList = new ArrayList();

    java.text.SimpleDateFormat isoDateTimeFormat =
            new java.text.SimpleDateFormat(TIME_FORMAT);
    isoDateTimeFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));

    lat_min = 1000.0;
    lat_max = -1000.0;
    lon_min = 1000.0;
    lon_max = -1000.0;
    time_min = Double.POSITIVE_INFINITY;
    time_max = Double.NEGATIVE_INFINITY;

    raf.seek(0);
    int count = 0;
    boolean knowExtended = false;
    while (true) {
      long offset = raf.getFilePointer();
      String line = raf.readLine();
      if (line == null) {
        break;
      }
      if (pMAGIC.matcher(line).find() || pMAGIC_OLD.matcher(line).find()) {
        if (!knowExtended) {
          isExtended = pMAGIC_EX.matcher(line).find();
          if (isExtended) {
            isoDateTimeFormat.applyPattern(TIME_FORMAT_EX);
          }
          knowExtended = true;
        }
        continue;
      }

      // 2006-10-23T17:59:39,18.415434,-93.480526,-26.8,1             (original)
      // 2006-10-23T17:59:39,18.415434,-93.480526,-26.8,0.25,0.5,80   (extended)

      StringTokenizer stoker = new StringTokenizer(line, ",\r\n");
      while (stoker.hasMoreTokens()) {
        Date date = isoDateTimeFormat.parse(stoker.nextToken());
        double lat = Double.parseDouble(stoker.nextToken());
        double lon = Double.parseDouble(stoker.nextToken());
        double amp = Double.parseDouble(stoker.nextToken());
        int nstrokes = 1;
        double axisMaj = Double.NaN;
        double axisMin = Double.NaN;
        int orient = 0;
        if (isExtended) {
          axisMaj = Double.parseDouble(stoker.nextToken());
          axisMin = Double.parseDouble(stoker.nextToken());
          orient = Integer.parseInt(stoker.nextToken());
        } else {
          nstrokes = Integer.parseInt(stoker.nextToken());
        }

        Stroke s = isExtended
                ? new Stroke(date, lat, lon, amp, axisMaj,
                axisMin, orient)
                : new Stroke(date, lat, lon, amp, nstrokes);
        lat_min = Math.min(lat_min, s.lat);
        lat_max = Math.max(lat_max, s.lat);
        lon_min = Math.min(lon_min, s.lon);
        lon_max = Math.max(lon_max, s.lon);
        time_min = Math.min(time_min, s.secs);
        time_max = Math.max(time_max, s.secs);
      }

      offsetList.add(new Long(offset));
      count++;
    }

    offsets = new long[count];
    for (int i = 0; i < offsetList.size(); i++) {
      Long off = (Long) offsetList.get(i);
      offsets[i] = off.longValue();
    }

    //System.out.println("processed " + count + " records");
    return count;
  }
int readAllData(RandomAccessFile raf)
          throws IOException, NumberFormatException, ParseException {
    ArrayList offsetList = new ArrayList();

    java.text.SimpleDateFormat isoDateTimeFormat =
            new java.text.SimpleDateFormat(TIME_FORMAT);
    isoDateTimeFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));

    lat_min = 1000.0;
    lat_max = -1000.0;
    lon_min = 1000.0;
    lon_max = -1000.0;
    time_min = Double.POSITIVE_INFINITY;
    time_max = Double.NEGATIVE_INFINITY;

    raf.seek(0);
    int count = 0;
    boolean knowExtended = false;
    while (true) {
      long offset = raf.getFilePointer();
      String line = raf.readLine();
      if (line == null) {
        break;
      }
      if (pMAGIC.matcher(line).find() || pMAGIC_OLD.matcher(line).find()) {
        if (!knowExtended) {
          isExtended = pMAGIC_EX.matcher(line).find();
          if (isExtended) {
            isoDateTimeFormat.applyPattern(TIME_FORMAT_EX);
          }
          knowExtended = true;
        }
        continue;
      }

      // 2006-10-23T17:59:39,18.415434,-93.480526,-26.8,1             (original)
      // 2006-10-23T17:59:39,18.415434,-93.480526,-26.8,0.25,0.5,80   (extended)

      StringTokenizer stoker = new StringTokenizer(line, ",\r\n");
      while (stoker.hasMoreTokens()) {
        Date date = isoDateTimeFormat.parse(stoker.nextToken());
        double lat = Double.parseDouble(stoker.nextToken());
        double lon = Double.parseDouble(stoker.nextToken());
        double amp = Double.parseDouble(stoker.nextToken());
        int nstrokes = 1;
        double axisMaj = Double.NaN;
        double axisMin = Double.NaN;
        int orient = 0;
        if (isExtended) {
          axisMaj = Double.parseDouble(stoker.nextToken());
          axisMin = Double.parseDouble(stoker.nextToken());
          orient = Integer.parseInt(stoker.nextToken());
        } else {
          nstrokes = Integer.parseInt(stoker.nextToken());
        }

        Stroke s = isExtended
                ? new Stroke(date, lat, lon, amp, axisMaj,
                axisMin, orient)
                : new Stroke(date, lat, lon, amp, nstrokes);
        lat_min = Math.min(lat_min, s.lat);
        lat_max = Math.max(lat_max, s.lat);
        lon_min = Math.min(lon_min, s.lon);
        lon_max = Math.max(lon_max, s.lon);
        time_min = Math.min(time_min, s.secs);
        time_max = Math.max(time_max, s.secs);
      }

      offsetList.add(new Long(offset));
      count++;
    }

    offsets = new long[count];
    for (int i = 0; i < offsetList.size(); i++) {
      Long off = (Long) offsetList.get(i);
      offsets[i] = off.longValue();
    }

    //System.out.println("processed " + count + " records");
    return count;
  }
int readAllData ( RandomAccessFile raf ) throws IOException , NumberFormatException , ParseException { ArrayList offsetList = new ArrayList ( ) ; java . text . SimpleDateFormat isoDateTimeFormat = new java . text . SimpleDateFormat ( TIME_FORMAT ) ; isoDateTimeFormat . setTimeZone ( java . util . TimeZone . getTimeZone ( "GMT" ) ) ; lat_min = 1000.0 ; lat_max = - 1000.0 ; lon_min = 1000.0 ; lon_max = - 1000.0 ; time_min = Double . POSITIVE_INFINITY ; time_max = Double . NEGATIVE_INFINITY ; raf . seek ( 0 ) ; int count = 0 ; boolean knowExtended = false ; while ( true ) { long offset = raf . getFilePointer ( ) ; String line = raf . readLine ( ) ; if ( line == null ) { break ; } if ( pMAGIC . matcher ( line ) . find ( ) || pMAGIC_OLD . matcher ( line ) . find ( ) ) { if ( ! knowExtended ) { isExtended = pMAGIC_EX . matcher ( line ) . find ( ) ; if ( isExtended ) { isoDateTimeFormat . applyPattern ( TIME_FORMAT_EX ) ; } knowExtended = true ; } continue ; } // 2006-10-23T17:59:39,18.415434,-93.480526,-26.8,1             (original)
 // 2006-10-23T17:59:39,18.415434,-93.480526,-26.8,0.25,0.5,80   (extended)
 StringTokenizer stoker = new StringTokenizer ( line , ",\r\n" ) ; while ( stoker . hasMoreTokens ( ) ) { Date date = isoDateTimeFormat . parse ( stoker . nextToken ( ) ) ; double lat = Double . parseDouble ( stoker . nextToken ( ) ) ; double lon = Double . parseDouble ( stoker . nextToken ( ) ) ; double amp = Double . parseDouble ( stoker . nextToken ( ) ) ; int nstrokes = 1 ; double axisMaj = Double . NaN ; double axisMin = Double . NaN ; int orient = 0 ; if ( isExtended ) { axisMaj = Double . parseDouble ( stoker . nextToken ( ) ) ; axisMin = Double . parseDouble ( stoker . nextToken ( ) ) ; orient = Integer . parseInt ( stoker . nextToken ( ) ) ; } else { nstrokes = Integer . parseInt ( stoker . nextToken ( ) ) ; } Stroke s = isExtended ? new Stroke ( date , lat , lon , amp , axisMaj , axisMin , orient ) : new Stroke ( date , lat , lon , amp , nstrokes ) ; lat_min = Math . min ( lat_min , s . lat ) ; lat_max = Math . max ( lat_max , s . lat ) ; lon_min = Math . min ( lon_min , s . lon ) ; lon_max = Math . max ( lon_max , s . lon ) ; time_min = Math . min ( time_min , s . secs ) ; time_max = Math . max ( time_max , s . secs ) ; } offsetList . add ( new Long ( offset ) ) ; count ++ ; } offsets = new long [ count ] ; for ( int i = 0 ; i < offsetList . size ( ) ; i ++ ) { Long off = ( Long ) offsetList . get ( i ) ; offsets [ i ] = off . longValue ( ) ; } //System.out.println("processed " + count + " records");
 return count ; }
Read all the data and return the number of strokes

@param raf the file to read
@return the number of strokes
@throws IOException           if read error
@throws NumberFormatException if problem parsing data
@throws ParseException        if parse problem
Read all the data and return the number of strokes