public class ImageLoader
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clears the in-memory image cache
|
static ImageLoader |
getInstance()
Get the shared instance of the ImageLoader
|
byte[] |
loadBytes(java.lang.String name)
Loads the named image, and returns its raw bytes.
|
java.awt.Image |
loadImage(java.lang.String name)
Loads the named image.
|
java.awt.Image |
loadImage(java.lang.String name,
java.awt.Dimension size)
Loads the named image and resizes it to the given size.
|
java.awt.Image |
loadImage(java.lang.String name,
int width,
int height)
Deprecated.
|
java.awt.Image |
loadImageNoCache(java.lang.String name,
java.awt.Dimension size)
Loads the named image at the given size, but skips any caching mechanism.
|
static void |
setCacheDir(java.io.File cacheDir)
Set the directory used to cache images and their resized versions
|
public static ImageLoader getInstance()
public static void setCacheDir(java.io.File cacheDir)
@Deprecated public java.awt.Image loadImage(java.lang.String name, int width, int height)
loadImage(String, Dimension)
instead.public java.awt.Image loadImage(java.lang.String name)
name
- public java.awt.Image loadImage(java.lang.String name, java.awt.Dimension size)
name
- The path to the image. May be a path to a gateway image or a URLsize
- The size to resize the image to. May be null, which means to use the natural size.public java.awt.Image loadImageNoCache(java.lang.String name, java.awt.Dimension size)
name
- The path to the image or the URL to an image.size
- The size to resize the image to, or null meaning return the image at its natural size.public byte[] loadBytes(java.lang.String name)
name
- public void clearCache()