Split out the creation of the file & network resource bundles so that subclasses can potentially create their own extensions to these.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@515 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Mike Thomas
2008-05-29 23:44:40 +00:00
parent d6319c128d
commit 2381ec5640
@@ -720,19 +720,37 @@ public class ResourceManager
List<ResourceBundle> dlist)
{
if (setType.equals(FILE_SET_TYPE)) {
FileResourceBundle bundle = new FileResourceBundle(getResourceFile(path), true,
_unpack);
FileResourceBundle bundle =
createFileResourceBundle(getResourceFile(path), true, _unpack);
if (!bundle.isUnpacked() || !bundle.sourceIsReady()) {
dlist.add(bundle);
}
return bundle;
} else if (setType.equals(NETWORK_SET_TYPE)) {
return new NetworkResourceBundle(_networkRootPath, path, getResourceList());
return createNetworkResourceBundle(_networkRootPath, path, getResourceList());
} else {
throw new IllegalArgumentException("Unknown set type: " + setType);
}
}
/**
* Creates an appropriate bundle for fetching resources from files.
*/
protected FileResourceBundle createFileResourceBundle(
File source, boolean delay, boolean unpack)
{
return new FileResourceBundle(source, delay, unpack);
}
/**
* Creates an appropriate bundle for fetching resources from the network.
*/
protected NetworkResourceBundle createNetworkResourceBundle(
String root, String path, HashSet<String> rsrcList)
{
return new NetworkResourceBundle(root, path, rsrcList);
}
/**
* Loads an image from the supplied file. Supports {@link FastImageIO} files and formats
* supported by {@link ImageIO} and will load the appropriate one based on the useFastIO param.