
org.tbk.spring.lnurl.security.ui.StaticTemplateUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-lnurl-auth-security Show documentation
Show all versions of spring-lnurl-auth-security Show documentation
spring lnurl-auth security package
package org.tbk.spring.lnurl.security.ui;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.FastByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
final class StaticTemplateUtils {
static String readContents(String filename) {
String file = StaticTemplateUtils.class.getPackage().getName().replace(".", "/") + "/" + filename;
try (FastByteArrayOutputStream os = new FastByteArrayOutputStream();
InputStream is = new ClassPathResource(file).getInputStream()) {
is.transferTo(os);
return new String(os.toByteArray(), StandardCharsets.UTF_8);
} catch (IOException e) {
throw new RuntimeException("Cannot read contents of file", e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy