Package com.browserup.bup.util
Class ClasspathResourceUtil
- java.lang.Object
-
- com.browserup.bup.util.ClasspathResourceUtil
-
public class ClasspathResourceUtil extends java.lang.ObjectUtility class for dealing with classpath resources.
-
-
Constructor Summary
Constructors Constructor Description ClasspathResourceUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringclasspathResourceToString(java.lang.String resource, java.nio.charset.Charset charset)Retrieves a classpath resource using theClasspathResourceUtilclassloader and converts it to a String using the specified character set.
-
-
-
Method Detail
-
classpathResourceToString
public static java.lang.String classpathResourceToString(java.lang.String resource, java.nio.charset.Charset charset) throws UncheckedIOExceptionRetrieves a classpath resource using theClasspathResourceUtilclassloader and converts it to a String using the specified character set. If any error occurs while reading the resource, this method throwsUncheckedIOException. If the classpath resource cannot be found, this method throws a FileNotFoundException wrapped in an UncheckedIOException.- Parameters:
resource- classpath resource to loadcharset- charset to use to decode the classpath resource- Returns:
- a String
- Throws:
UncheckedIOException- if the classpath resource cannot be found or cannot be read for any reason
-
-