BeanIO 1.2.3

org.beanio.util
Class IOUtil

java.lang.Object
  extended by org.beanio.util.IOUtil

public class IOUtil
extends Object

Utility class for manipulating streams.

Since:
1.0
Author:
Kevin Seim

Method Summary
static void closeQuietly(InputStream in)
          Closes an input stream and quietly ignores any exception.
static void closeQuietly(OutputStream out)
          Closes an output stream and quietly ignores any exception.
static void closeQuietly(Reader in)
          Closes an input stream and quietly ignores any exception.
static void closeQuietly(Writer out)
          Closes an output stream and quietly ignores any exception.
static URL getResource(String resource)
          Finds a resource on the classpath.
static InputStream getResourceAsStream(String resource)
          Loads a resource from the classpath.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

closeQuietly

public static void closeQuietly(Reader in)
Closes an input stream and quietly ignores any exception.

Parameters:
in - the stream to close

closeQuietly

public static void closeQuietly(Writer out)
Closes an output stream and quietly ignores any exception.

Parameters:
out - the stream to close

closeQuietly

public static void closeQuietly(InputStream in)
Closes an input stream and quietly ignores any exception.

Parameters:
in - the stream to close

closeQuietly

public static void closeQuietly(OutputStream out)
Closes an output stream and quietly ignores any exception.

Parameters:
out - the stream to close

getResource

public static URL getResource(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 null if the resource was not found
Since:
1.2.1

getResourceAsStream

public static InputStream getResourceAsStream(String resource)
                                       throws IOException
Loads a resource from the classpath.

Parameters:
resource - the name of the resource to load
Returns:
a new InputStream to read the resource or null if the resource was not found
Throws:
IOException - if an I/O error occurs
Since:
1.2

BeanIO 1.2.3

Copyright © 2010-2012 Kevin Seim