// read in the index, index raf already open
 public static GribCollection createFromIndex(
     String name, File directory, RandomAccessFile raf, FeatureCollectionConfig.GribConfig config)
     throws IOException {
   Grib2CollectionBuilder builder = new Grib2CollectionBuilder(name, directory, config);
   if (builder.readIndex(raf)) return builder.gc;
   throw new IOException("Reading index failed");
 }
 // called by tdm
 public static boolean update(CollectionManager dcm, Formatter f) throws IOException {
   Grib2CollectionBuilder builder = new Grib2CollectionBuilder(dcm);
   if (!builder.needsUpdate()) return false;
   builder.readOrCreateIndex(CollectionManager.Force.always, f);
   builder.gc.close();
   return true;
 }
 // from a single file, read in the index, create if it doesnt exist
 public static GribCollection readOrCreateIndexFromSingleFile(
     MFile file,
     CollectionManager.Force force,
     FeatureCollectionConfig.GribConfig config,
     Formatter f)
     throws IOException {
   Grib2CollectionBuilder builder = new Grib2CollectionBuilder(file, config, f);
   builder.readOrCreateIndex(force, f);
   return builder.gc;
 }
 // this writes the index always
 public static boolean writeIndexFile(File indexFile, CollectionManager dcm, Formatter f)
     throws IOException {
   Grib2CollectionBuilder builder = new Grib2CollectionBuilder(dcm);
   return builder.createIndex(indexFile, CollectionManager.Force.always, f);
 }
 // from a collection, read in the index, create if it doesnt exist or is out of date
 // assume that the CollectionManager is up to date, eg doesnt need to be scanned
 public static GribCollection factory(
     CollectionManager dcm, CollectionManager.Force force, Formatter f) throws IOException {
   Grib2CollectionBuilder builder = new Grib2CollectionBuilder(dcm);
   builder.readOrCreateIndex(force, f);
   return builder.gc;
 }
 // from a single file, read in the index, create if it doesnt exist
 public static GribCollection createFromSingleFile(
     File file, CollectionManager.Force force, Formatter f) throws IOException {
   Grib2CollectionBuilder builder = new Grib2CollectionBuilder(file, f);
   builder.readOrCreateIndex(force, f);
   return builder.gc;
 }