Package org.beanio.internal.util
Class IOUtil
- java.lang.Object
-
- org.beanio.internal.util.IOUtil
-
public class IOUtil extends java.lang.ObjectUtility class for manipulating streams.- Since:
- 1.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcloseQuietly(java.io.InputStream in)Closes an input stream and quietly ignores any exception.static voidcloseQuietly(java.io.OutputStream out)Closes an output stream and quietly ignores any exception.static voidcloseQuietly(java.io.Reader in)Closes an input stream and quietly ignores any exception.static voidcloseQuietly(java.io.Writer out)Closes an output stream and quietly ignores any exception.static java.net.URLgetResource(java.lang.ClassLoader classLoader, java.lang.String resource)Finds a resource on the classpath.static java.io.InputStreamgetResourceAsStream(java.lang.String resource)Loads a resource from the classpath.
-
-
-
Method Detail
-
closeQuietly
public static void closeQuietly(java.io.Reader in)
Closes an input stream and quietly ignores any exception.- Parameters:
in- the stream to close
-
closeQuietly
public static void closeQuietly(java.io.Writer out)
Closes an output stream and quietly ignores any exception.- Parameters:
out- the stream to close
-
closeQuietly
public static void closeQuietly(java.io.InputStream in)
Closes an input stream and quietly ignores any exception.- Parameters:
in- the stream to close
-
closeQuietly
public static void closeQuietly(java.io.OutputStream out)
Closes an output stream and quietly ignores any exception.- Parameters:
out- the stream to close
-
getResource
public static java.net.URL getResource(java.lang.ClassLoader classLoader, java.lang.String resource)Finds a resource on the classpath. The resource is always loaded from the root of the classpath, whether the resource name includes a leading slash or not.- Parameters:
resource- the name of the resource to load- Returns:
- the resource URL, or
nullif the resource was not found - Since:
- 1.2.1
-
getResourceAsStream
public static java.io.InputStream getResourceAsStream(java.lang.String resource) throws java.io.IOExceptionLoads a resource from the classpath.- Parameters:
resource- the name of the resource to load- Returns:
- a new
InputStreamto read the resource ornullif the resource was not found - Throws:
java.io.IOException- if an I/O error occurs- Since:
- 1.2
-
-