|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hudsonci.utils.io.FileUtil
public class FileUtil
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.
| 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 |
|---|
public FileUtil()
| Method Detail |
|---|
public static File canonicalize(File file)
public static URL getResource(String resource)
public static File getResourceAsFile(String resource)
public static File getResourceAsFile(Class clazz,
String resource)
public static InputStream getResourceAsStream(String resource)
public static InputStream getResourceAsStream(Class clazz,
String resource)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||