content: package tech.thegamedefault.wrappyj.generator.utility;
  
  import static java.nio.charset.StandardCharsets.UTF_8;
  
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.Reader;
  import java.io.UncheckedIOException;
  import org.springframework.core.io.DefaultResourceLoader;
  import org.springframework.core.io.Resource;
  import org.springframework.core.io.ResourceLoader;
  import org.springframework.util.FileCopyUtils;
  
  public class FileUtility {
  
    private FileUtility() {
      throw new IllegalStateException("Utility class");
    }
  
    public static String readResourceFile(String path) {
      ResourceLoader resourceLoader = new DefaultResourceLoader();
      Resource resource = resourceLoader.getResource(path);
      return asString(resource);
    }
  
    private static String asString(Resource resource) {
      try (Reader reader = new InputStreamReader(resource.getInputStream(), UTF_8)) {
        return FileCopyUtils.copyToString(reader);
      } catch (IOException e) {
        throw new UncheckedIOException(e);
      }
    }
  
  
  }
  