/**
   * Tests whether Bio-Formats is potentially capable of importing the given file IDs. Outputs the
   * IDs it can potentially import, one group per line, with elements of the each group separated by
   * spaces.
   */
  public void testIds(int[] fileIds) throws OmeisException, FormatException, IOException {
    Arrays.sort(fileIds);

    // set up file path mappings
    String[] ids = new String[fileIds.length];
    for (int i = 0; i < fileIds.length; i++) {
      Hashtable fileInfo = getFileInfo(fileIds[i]);
      ids[i] = (String) fileInfo.get("Name");
      String path = getLocalFilePath(fileIds[i]);
      Location.mapId(ids[i], path);
    }

    // check types and groups
    if (http) printHttpResponseHeader();
    boolean[] done = new boolean[fileIds.length];
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < fileIds.length; i++) {
      if (done[i]) continue; // already part of another group
      if (ids[i] == null) continue; // invalid id
      if (!reader.isThisType(ids[i])) continue; // unknown format
      reader.setId(ids[i]);
      String[] files = reader.getUsedFiles();

      if (files == null) continue; // invalid files list
      sb.setLength(0);

      for (int j = files.length - 1; j >= 0; j--) {
        for (int ii = i; ii < fileIds.length; ii++) {
          if (files[j] == null) {
            log("Warning: FileID " + fileIds[ii] + " ('" + ids[ii] + "') has null used file #" + j);
          } else if (files[j].equals(ids[ii])) {
            if (done[ii]) {
              log(
                  "Warning: FileID "
                      + fileIds[ii]
                      + " ('"
                      + ids[ii]
                      + "') already belongs to a group");
            }
            done[ii] = true;
            if (j < files.length - 1) sb.append(" ");
            sb.append(fileIds[ii]);
            break;
          }
        }
      }
      System.out.println(sb.toString());
    }
  }