public class ResourceUtil extends Object
Constructor and Description |
---|
ResourceUtil() |
Modifier and Type | Method and Description |
---|---|
static BufferedImage |
getImage(String resourceName)
Retrieve an image resource
|
static ImageIcon |
getImageIcon(String resourceName)
Retrieve an image icon resource.
|
static InputStream |
getInputStream(String resourceName)
Get an inputstream on the specified resource.
|
static Properties |
getProperties(String resourceName)
Retrieve a properties resource.
|
static String |
getString(String resourceName)
Retrieve the String contents of the specified resource, obtained by opening in inputstream on the resource and
then interpreting the bytes contained in the inputstream as if they represented characters.
|
static URL |
getURL(String resourceName)
The URL to the specified resource
|
static Set<URL> |
getURLs(String resourceName)
Get the URLs for a resource name using the class loaders of the current thread and of the caller.
|
static void |
resourceToFile(String resourceName,
File output)
Store a resource to a file on the file system.
|
public static URL getURL(String resourceName)
resourceName
- the name of the resourcepublic static Set<URL> getURLs(String resourceName) throws IOException
resourceName
- IOException
public static InputStream getInputStream(String resourceName)
resourceName
- the name of the resourcepublic static String getString(String resourceName) throws IOException
resourceName
- the name of the resourceIOException
- when something goes wrong trying to read the resourcepublic static ImageIcon getImageIcon(String resourceName)
resourceName
- the name of the resourcepublic static BufferedImage getImage(String resourceName)
resourceName
- the name of the resourcepublic static Properties getProperties(String resourceName) throws IOException
resourceName
- the name of the resourceIOException
public static void resourceToFile(String resourceName, File output) throws IOException
resourceName
- the name of the resourceoutput
- the file to write toIOException
- if there was a problem reading the resource or writing to the fileCopyright © 2015-2022 Eclipse Foundation. All Rights Reserved.