cdm/src/main/java/ucar/nc2/iosp/noaa/Ghcnm2.java
private void readIndex(String indexFilename) throws IOException {
    try (FileInputStream fin = new FileInputStream(indexFilename)) {

      if (!NcStream.readAndTest(fin, MAGIC_START_IDX.getBytes(CDM.utf8Charset)))
        throw new IllegalStateException("bad index file");
      int version = fin.read();
      if (version != 1)
        throw new IllegalStateException("Bad version = " + version);

      int count = NcStream.readVInt(fin);

      for (int i = 0; i < count; i++) {
        int size = NcStream.readVInt(fin);
        byte[] pb = new byte[size];
        NcStream.readFully(fin, pb);
        StationIndex si = decodeStationIndex(pb);
        map.put(si.stnId, si);
      }
    }

    System.out.println(" read index map size=" + map.values().size());
  }
private void readIndex(String indexFilename) throws IOException {
    try (FileInputStream fin = new FileInputStream(indexFilename)) {

      if (!NcStream.readAndTest(fin, MAGIC_START_IDX.getBytes(CDM.utf8Charset)))
        throw new IllegalStateException("bad index file");
      int version = fin.read();
      if (version != 1)
        throw new IllegalStateException("Bad version = " + version);

      int count = NcStream.readVInt(fin);

      for (int i = 0; i < count; i++) {
        int size = NcStream.readVInt(fin);
        byte[] pb = new byte[size];
        NcStream.readFully(fin, pb);
        StationIndex si = decodeStationIndex(pb);
        map.put(si.stnId, si);
      }
    }

    System.out.println(" read index map size=" + map.values().size());
  }
private void readIndex ( String indexFilename ) throws IOException { try ( FileInputStream fin = new FileInputStream ( indexFilename ) ) { if ( ! NcStream . readAndTest ( fin , MAGIC_START_IDX . getBytes ( CDM . utf8Charset ) ) ) throw new IllegalStateException ( "bad index file" ) ; int version = fin . read ( ) ; if ( version != 1 ) throw new IllegalStateException ( "Bad version = " + version ) ; int count = NcStream . readVInt ( fin ) ; for ( int i = 0 ; i < count ; i ++ ) { int size = NcStream . readVInt ( fin ) ; byte [ ] pb = new byte [ size ] ; NcStream . readFully ( fin , pb ) ; StationIndex si = decodeStationIndex ( pb ) ; map . put ( si . stnId , si ) ; } } System . out . println ( " read index map size=" + map . values ( ) . size ( ) ) ; }
/////////////////////////////////////////
/////////////////////////////////////////