|
Brooklyn | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbrooklyn.util.ResourceUtils
public class ResourceUtils
Constructor Summary | |
ResourceUtils(java.lang.ClassLoader loader, java.lang.String context)
context string used for errors |
|
ResourceUtils(java.lang.Object context)
uses the classloader of the given object, and the phrase object's toString (preceded by the word 'for') as the context string used in errors |
Method Summary | |
---|---|
static java.lang.Thread
|
addShutdownHook(java.lang.Runnable task)
|
static void
|
copy(java.io.InputStream input, java.io.OutputStream output)
|
java.lang.ClassLoader
|
getLoader()
|
java.lang.String
|
getResourceAsString(java.lang.String url)
takes getResourceFromUrl(String) and reads fully, into a string |
java.io.InputStream
|
getResourceFromUrl(java.lang.String url)
Takes a string which is treated as a URL (with some extended "schemes" also expected), or as a path to something either on the classpath (absolute only) or the local filesystem (relative or absolute, depending on leading slash) |
static java.lang.String
|
mergePaths(java.lang.String... items)
returns the items with exactly one "/" between items (whether or not the individual items start or end with /) |
static byte[]
|
readFullyBytes(java.io.InputStream is)
|
static java.lang.String
|
readFullyString(java.io.InputStream is)
|
static boolean
|
removeShutdownHook(java.lang.Thread hook)
|
static java.io.File
|
writeToTempFile(java.io.InputStream is, java.lang.String prefix, java.lang.String suffix)
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Constructor Detail |
---|
public ResourceUtils(java.lang.ClassLoader loader, java.lang.String context)
@SuppressWarnings("rawtypes") public ResourceUtils(java.lang.Object context)
Method Detail |
---|
public static java.lang.Thread addShutdownHook(java.lang.Runnable task)
public static void copy(java.io.InputStream input, java.io.OutputStream output)
public java.lang.ClassLoader getLoader()
public java.lang.String getResourceAsString(java.lang.String url)
public java.io.InputStream getResourceFromUrl(java.lang.String url)
URLs can be of the form classpath://com/acme/Foo.properties as well as file:///home/... and http://acme.com/....
Throws exception if not found, using the context parameter passed into the constructor.
TODO may want OSGi, or typed object; should consider pax url
public static java.lang.String mergePaths(java.lang.String... items)
public static byte[] readFullyBytes(java.io.InputStream is)
public static java.lang.String readFullyString(java.io.InputStream is)
public static boolean removeShutdownHook(java.lang.Thread hook)
public static java.io.File writeToTempFile(java.io.InputStream is, java.lang.String prefix, java.lang.String suffix)
Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.