static Tuple<Map<String,String>,Long> readLegacyChecksums(Directory directory) throws IOException {
synchronized (directory) {
    long lastFound=-1;
    for (    String name : directory.listAll()) {
      if (!isChecksum(name)) {
        continue;
      }
      long current=Long.parseLong(name.substring(CHECKSUMS_PREFIX.length()));
      if (current > lastFound) {
        lastFound=current;
      }
    }
    if (lastFound > -1) {
      try (IndexInput indexInput=directory.openInput(CHECKSUMS_PREFIX + lastFound,IOContext.READONCE)){
        indexInput.readInt();
        return new Tuple(indexInput.readStringStringMap(),lastFound);
      }
     }
    return new Tuple(new HashMap<>(),-1l);
  }
}

static Tuple < Map < String , String > , Long > readLegacyChecksums ( Directory directory ) throws IOException { synchronized ( directory ) { long lastFound = - 1 ; for ( String name : directory . listAll ( ) ) { if ( ! isChecksum ( name ) ) { continue ; } long current = Long . parseLong ( name . substring ( CHECKSUMS_PREFIX . length ( ) ) ) ; if ( current > lastFound ) { lastFound = current ; } } if ( lastFound > - 1 ) { try ( IndexInput indexInput = directory . openInput ( CHECKSUMS_PREFIX + lastFound , IOContext . READONCE ) ) { indexInput . readInt ( ) ; return new Tuple ( indexInput . readStringStringMap ( ) , lastFound ) ; } } return new Tuple ( new HashMap < > ( ) , - 1l ) ; } }
reads legacy checksum files found in the directory . < p / > files are expected to start with _checksums - prefix followed by long file version . only file with the highest version is read , all other files are ignored .
