@SuppressWarnings("squid:S106")
  public static void printResource(String filename) throws IOException {
    filename = filename.substring(0, filename.length() - 9);
    TsFileResource resource = new TsFileResource(SystemFileFactory.INSTANCE.getFile(filename));
    System.out.printf("Analyzing %s ...%n", filename);
    System.out.println();
    resource.deserialize();
    System.out.println("Time index type: " + resource.getTimeIndexType());

    System.out.printf(
        "Resource plan index range [%d, %d]%n",
        resource.getMinPlanIndex(), resource.getMaxPlanIndex());

    for (IDeviceID device : resource.getDevices()) {
      // iterating the index, must present
      //noinspection OptionalGetWithoutIsPresent
      System.out.printf(
          "device %s, start time %d (%s), end time %d (%s)%n",
          device,
          resource.getStartTime(device).get(),
          DateTimeUtils.convertLongToDate(resource.getStartTime(device).get()),
          resource.getEndTime(device).get(),
          DateTimeUtils.convertLongToDate(resource.getEndTime(device).get()));
    }
    System.out.println();
  }
This tool can analyze the tsfile.resource files from a folder, or analyze a single
tsfile.resource file.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/tools/TsFileResourcePrinter.java