All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mntviews.jreport.JRUtil Maven / Gradle / Ivy

There is a newer version: 1.2.2
Show newest version
package com.mntviews.jreport;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.stream.Collectors;

public class JRUtil {

    public static String convertResourceToString(String fileName) throws IOException {
        try (InputStream inputStream = JRUtil.class.getClassLoader().getResourceAsStream(fileName)) {
            if (inputStream == null)
                return null;
            try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
                return bufferedReader.lines().collect(Collectors.joining(System.lineSeparator()));
            }
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy