org.hudsonci.utils.io
Class FileUtil

java.lang.Object
  extended by org.hudsonci.utils.io.FileUtil

public class FileUtil
extends Object

I usually put these into something like "ResourceManager" and use it to do all the loading. This manager can then cope with the exceptions and logging so each part of the application doesn't have to. Having a separate manager for it also makes it easier to mock in tests to verify interactions.

Since:
2.1.0
Author:
Jamie Whitehouse

Constructor Summary
FileUtil()
           
 
Method Summary
static File canonicalize(File file)
           
static URL getResource(String resource)
           
static File getResourceAsFile(Class clazz, String resource)
          Gets a resource relative to the given class.
static File getResourceAsFile(String resource)
           
static InputStream getResourceAsStream(Class clazz, String resource)
          Gets a resource using the given classes classloader.
static InputStream getResourceAsStream(String resource)
          Gets a resource using the current threads classloader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtil

public FileUtil()
Method Detail

canonicalize

public static File canonicalize(File file)

getResource

public static URL getResource(String resource)

getResourceAsFile

public static File getResourceAsFile(String resource)

getResourceAsFile

public static File getResourceAsFile(Class clazz,
                                     String resource)
Gets a resource relative to the given class.


getResourceAsStream

public static InputStream getResourceAsStream(String resource)
Gets a resource using the current threads classloader.


getResourceAsStream

public static InputStream getResourceAsStream(Class clazz,
                                              String resource)
Gets a resource using the given classes classloader.



Copyright © 2004-2012 Hudson. All Rights Reserved.