public class FileResourceBundle extends ResourceBundle
| Constructor and Description |
|---|
FileResourceBundle(File source)
Constructs a resource bundle with the supplied jar file.
|
FileResourceBundle(File source,
boolean delay,
boolean unpack)
Constructs a resource bundle with the supplied jar file.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsResource(String path)
Returns true if this resource bundle contains the resource with the specified path.
|
static File |
getCacheDir()
Returns the cache directory used for unpacked resources.
|
String |
getIdent()
Uniquely identifies this resource bundle.
|
BufferedImage |
getImageResource(String path,
boolean useFastIO)
Decodes and returns the specified image resource.
|
InputStream |
getResource(String path)
Fetches the named resource from this bundle.
|
File |
getResourceFile(String path)
Returns a file from which the specified resource can be loaded.
|
File |
getSource()
Returns the
File from which resources are fetched for this bundle. |
boolean |
isUnpacked() |
static void |
setCacheDir(File tmpdir)
Specifies the directory in which our temporary resource files should be stored.
|
boolean |
sourceIsReady()
Called by the resource manager once it has ensured that our resource jar file is up to date
and ready for reading.
|
String |
toString() |
void |
wipeBundle(boolean deleteJar)
Clears out everything associated with this resource bundle in the hopes that we can
download it afresh and everything will work the next time around.
|
public FileResourceBundle(File source)
source - a file object that references our source jar file.public FileResourceBundle(File source, boolean delay, boolean unpack)
source - a file object that references our source jar file.delay - if true, the bundle will wait until someone calls sourceIsReady()
before allowing access to its resources.unpack - if true the bundle will unpack itself into a temporary directorypublic String getIdent()
ResourceBundlegetIdent in class ResourceBundlepublic InputStream getResource(String path) throws IOException
ResourceBundlesounds/scream.au.getResource in class ResourceBundlepath - the path to the resource in this jar file.IOException - thrown if an error occurs locating the resource in the jar file.public BufferedImage getImageResource(String path, boolean useFastIO) throws IOException
ResourceBundlegetImageResource in class ResourceBundleIOExceptionpublic File getSource()
File from which resources are fetched for this bundle.public boolean isUnpacked()
public boolean sourceIsReady()
public void wipeBundle(boolean deleteJar)
public File getResourceFile(String path) throws IOException
path - the path to the resource in this jar file.IOExceptionpublic boolean containsResource(String path)
public static File getCacheDir()
public static void setCacheDir(File tmpdir)
Copyright © 2015. All rights reserved.