code: public static String readResourceToString(@NotNull Class<?> clazz, @NotNull String resource) {
          try {
              try (Reader r = new BufferedReader(new InputStreamReader(clazz.getResourceAsStream(resource), "UTF-8"))) {
  
                  Writer writer = new StringWriter();
  
                  char[] buffer = new char[1024];
                  int n;
                  while ((n = r.read(buffer)) != -1) {
                      writer.write(buffer, 0, n);
                  }
  
                  return writer.toString();
              }
          } catch (IOException ioe) {
              throw new RuntimeException(ioe);
          }
      }
docs: Avoid using this method for constant reads, use it only for one time only reads from resources in the classpath