Package com.identity4j.util
Class IOUtil
- java.lang.Object
-
- com.identity4j.util.IOUtil
-
public class IOUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description IOUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static InputStreamgetStreamFromResource(Class<?> clazz, String resourceName)Get a string from a Resource .static StringgetStringFromResource(Class<?> clazz, String resourceName)Get a string from a Resource .static StringgetStringFromResource(Class<?> clazz, String resourceName, String charset)Get a string from a Resource .
-
-
-
Method Detail
-
getStreamFromResource
public static InputStream getStreamFromResource(Class<?> clazz, String resourceName) throws IOException
Get a string from a Resource . This can either be a URL, an absolute file name or a relative file name. A special URL that has a scheme of res is also supported, this gets the resource by name from the classloader that providedclazz.- Parameters:
clazz- class to get classloader from (nullto skip loading as classpath resource)resourceName- resource name- Returns:
- resource stream
- Throws:
IOExceptionIOException- on any error loading
-
getStringFromResource
public static String getStringFromResource(Class<?> clazz, String resourceName) throws IOException
Get a string from a Resource . This can either be a URL, an absolute file name or a relative file name. A special URL that has a scheme of res is also supported, this gets the resource by name from the classloader that providedclazz.- Parameters:
clazz- class to get classloader from (nullto skip loading as classpath resource)resourceName- resource name- Returns:
- content of resource
- Throws:
IOExceptionIOException- on any error loading
-
getStringFromResource
public static String getStringFromResource(Class<?> clazz, String resourceName, String charset) throws IOException
Get a string from a Resource . This can either be a URL, an absolute file name or a relative file name. A special URL that has a scheme of res is also supported, this gets the resource by name from the classloader that providedclazz.- Parameters:
clazz- class to get classloader from (nullto skip loading as classpath resource)resourceName- resource namecharset- character set- Returns:
- content of resource
- Throws:
IOExceptionIOException- on any error loading
-
-