From 2381ec5640196123cd0b882bdd18cbddd4cf8086 Mon Sep 17 00:00:00 2001 From: Mike Thomas Date: Thu, 29 May 2008 23:44:40 +0000 Subject: [PATCH] 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 --- .../threerings/resource/ResourceManager.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/java/com/threerings/resource/ResourceManager.java b/src/java/com/threerings/resource/ResourceManager.java index b4742204..451a08e1 100644 --- a/src/java/com/threerings/resource/ResourceManager.java +++ b/src/java/com/threerings/resource/ResourceManager.java @@ -720,19 +720,37 @@ public class ResourceManager List 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 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.