Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.util
Class IOUtils

    java.lang.Object
      org.apache.commons.io.IOUtils
          org.mule.util.IOUtils

    public class IOUtils

extends IOUtils

Mule input/output utilities.

Field Summary

Fields inherited from class org.apache.commons.io.IOUtils
`DIR_SEPARATOR, DIR_SEPARATOR_UNIX, DIR_SEPARATOR_WINDOWS, LINE_SEPARATOR, LINE_SEPARATOR_UNIX, LINE_SEPARATOR_WINDOWS`

Constructor Summary
`IOUtils()`

Method Summary
`static InputStream` | `getResourceAsStream(String resourceName, Class callingClass)` Attempts to load a resource from the file system, from a URL, or from the classpath, in that order.
`static InputStream` | `getResourceAsStream(String resourceName, Class callingClass, boolean tryAsFile, boolean tryAsUrl)` Attempts to load a resource from the file system, from a URL, or from the classpath, in that order.
`static String` | `getResourceAsString(String resourceName, Class callingClass)` Attempts to load a resource from the file system, from a URL, or from the classpath, in that order.
`static URL` | `getResourceAsUrl(String resourceName, Class callingClass)` Attempts to load a resource from the file system or from the classpath, in that order.
`static URL` | `getResourceAsUrl(String resourceName, Class callingClass, boolean tryAsFile, boolean tryAsUrl)` Attempts to load a resource from the file system or from the classpath, in that order.
`static byte[]` | `toByteArray(InputStream input)` This method wraps `IOUtils`' `toByteArray(InputStream)` method but catches any `IOException` and wraps it into a `RuntimeException`.
`static String` | `toString(InputStream input)` This method wraps `IOUtils`' `toString(InputStream)` method but catches any `IOException` and wraps it into a `RuntimeException`.

Methods inherited from class org.apache.commons.io.IOUtils
`closeQuietly, closeQuietly, closeQuietly, closeQuietly, contentEquals, contentEquals, copy, copy, copy, copy, copy, copy, copyLarge, copyLarge, lineIterator, lineIterator, readLines, readLines, readLines, toByteArray, toByteArray, toByteArray, toCharArray, toCharArray, toCharArray, toInputStream, toInputStream, toString, toString, toString, toString, write, write, write, write, write, write, write, write, write, write, write, write, writeLines, writeLines, writeLines`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### IOUtils

    public IOUtils()

Method Detail

### getResourceAsString

    public static String getResourceAsString(String resourceName,
                                             Class callingClass)
                                      throws IOException

  Attempts to load a resource from the file system, from a URL, or from the classpath, in that order.

  Parameters:
    `resourceName` - The name of the resource to load
    `callingClass` - The Class object of the calling object
  Returns:
    the requested resource as a string
  Throws:
    `IOException` - IO error

### getResourceAsStream

    public static InputStream getResourceAsStream(String resourceName,
                                                  Class callingClass)
                                           throws IOException

  Attempts to load a resource from the file system, from a URL, or from the classpath, in that order.

  Parameters:
    `resourceName` - The name of the resource to load
    `callingClass` - The Class object of the calling object
  Returns:
    an InputStream to the resource or null if resource not found
  Throws:
    `IOException` - IO error

### getResourceAsStream

    public static InputStream getResourceAsStream(String resourceName,
                                                  Class callingClass,
                                                  boolean tryAsFile,
                                                  boolean tryAsUrl)
                                           throws IOException

  Attempts to load a resource from the file system, from a URL, or from the classpath, in that order.

  Parameters:
    `resourceName` - The name of the resource to load
    `callingClass` - The Class object of the calling object
    `tryAsFile` - - try to load the resource from the local file system
    `tryAsUrl` - - try to load the resource as a URL
  Returns:
    an InputStream to the resource or null if resource not found
  Throws:
    `IOException` - IO error

### getResourceAsUrl

    public static URL getResourceAsUrl(String resourceName,
                                       Class callingClass)

  Attempts to load a resource from the file system or from the classpath, in that order.

  Parameters:
    `resourceName` - The name of the resource to load
    `callingClass` - The Class object of the calling object
  Returns:
    an URL to the resource or null if resource not found

### getResourceAsUrl

    public static URL getResourceAsUrl(String resourceName,
                                       Class callingClass,
                                       boolean tryAsFile,
                                       boolean tryAsUrl)

  Attempts to load a resource from the file system or from the classpath, in that order.

  Parameters:
    `resourceName` - The name of the resource to load
    `callingClass` - The Class object of the calling object
    `tryAsFile` - - try to load the resource from the local file system
    `tryAsUrl` - - try to load the resource as a Url string
  Returns:
    an URL to the resource or null if resource not found

### toString

    public static String toString(InputStream input)

  This method wraps `IOUtils`' `toString(InputStream)` method but catches any `IOException` and wraps it into a `RuntimeException`.

### toByteArray

    public static byte[] toByteArray(InputStream input)

  This method wraps `IOUtils`' `toByteArray(InputStream)` method but catches any `IOException` and wraps it into a `RuntimeException`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.