grib/src/main/java/ucar/nc2/grib/collection/GribCdmIndex.java
public static GribCollectionType getType(RandomAccessFile raf) throws IOException {
    String magic;

    raf.seek(0);
    magic = raf.readString(Grib2CollectionWriter.MAGIC_START.getBytes(CDM.utf8Charset).length);

    switch (magic) {
      case Grib2CollectionWriter.MAGIC_START:
        return GribCollectionType.GRIB2;

      case Grib1CollectionWriter.MAGIC_START:
        return GribCollectionType.GRIB1;

      case Grib2PartitionBuilder.MAGIC_START:
        return GribCollectionType.Partition2;

      case Grib1PartitionBuilder.MAGIC_START:
        return GribCollectionType.Partition1;

    }
    return GribCollectionType.none;
  }
public static GribCollectionType getType(RandomAccessFile raf) throws IOException {
    String magic;

    raf.seek(0);
    magic = raf.readString(Grib2CollectionWriter.MAGIC_START.getBytes(CDM.utf8Charset).length);

    switch (magic) {
      case Grib2CollectionWriter.MAGIC_START:
        return GribCollectionType.GRIB2;

      case Grib1CollectionWriter.MAGIC_START:
        return GribCollectionType.GRIB1;

      case Grib2PartitionBuilder.MAGIC_START:
        return GribCollectionType.Partition2;

      case Grib1PartitionBuilder.MAGIC_START:
        return GribCollectionType.Partition1;

    }
    return GribCollectionType.none;
  }
public static GribCollectionType getType ( RandomAccessFile raf ) throws IOException { String magic ; raf . seek ( 0 ) ; magic = raf . readString ( Grib2CollectionWriter . MAGIC_START . getBytes ( CDM . utf8Charset ) . length ) ; switch ( magic ) { case Grib2CollectionWriter . MAGIC_START : return GribCollectionType . GRIB2 ; case Grib1CollectionWriter . MAGIC_START : return GribCollectionType . GRIB1 ; case Grib2PartitionBuilder . MAGIC_START : return GribCollectionType . Partition2 ; case Grib1PartitionBuilder . MAGIC_START : return GribCollectionType . Partition1 ; } return GribCollectionType . none ; }
Find out what kind of index this is

@param raf open RAF
@return GribCollectionType
@throws IOException on read error
Find out what kind of index this is