Allowing raw images to be read from a stream.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@760 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Matt Jensen
2009-01-20 04:34:05 +00:00
parent 6258d6e28e
commit 3934ced69e
@@ -44,7 +44,7 @@ public class NetworkResourceBundle extends ResourceBundle
{ {
this(root, path, null); this(root, path, null);
} }
public NetworkResourceBundle (String root, String path, HashSet<String> rsrcList) public NetworkResourceBundle (String root, String path, HashSet<String> rsrcList)
{ {
if (!root.endsWith("/")) { if (!root.endsWith("/")) {
@@ -56,7 +56,7 @@ public class NetworkResourceBundle extends ResourceBundle
log.warning("Created malformed URL for resource. [root=" + root + ", path=" + path); log.warning("Created malformed URL for resource. [root=" + root + ", path=" + path);
} }
_ident = path; _ident = path;
_rsrcList = rsrcList; _rsrcList = rsrcList;
} }
@@ -74,11 +74,11 @@ public class NetworkResourceBundle extends ResourceBundle
if (!inResourceList(path)) { if (!inResourceList(path)) {
return null; return null;
} }
URL resourceUrl = new URL(_bundleURL, path); URL resourceUrl = new URL(_bundleURL, path);
return getResource(resourceUrl); return getResource(resourceUrl);
} }
protected static InputStream getResource(URL resourceUrl) protected static InputStream getResource(URL resourceUrl)
{ {
URLConnection ucon = null; URLConnection ucon = null;
@@ -91,7 +91,7 @@ public class NetworkResourceBundle extends ResourceBundle
if (ucon == null) { if (ucon == null) {
return null; return null;
} }
try { try {
ucon.connect(); ucon.connect();
return ucon.getInputStream(); return ucon.getInputStream();
@@ -112,7 +112,7 @@ public class NetworkResourceBundle extends ResourceBundle
if (in == null) { if (in == null) {
return null; return null;
} }
return ResourceManager.loadImage(in); return ResourceManager.loadImage(in, useFastIO);
} }
/** /**
@@ -123,7 +123,7 @@ public class NetworkResourceBundle extends ResourceBundle
{ {
return _rsrcList == null || _rsrcList.contains(_ident + path); return _rsrcList == null || _rsrcList.contains(_ident + path);
} }
/** /**
* Returns a string representation of this resource bundle. * Returns a string representation of this resource bundle.
*/ */
@@ -138,7 +138,7 @@ public class NetworkResourceBundle extends ResourceBundle
/** Our root url to the resources in this bundle. */ /** Our root url to the resources in this bundle. */
protected URL _bundleURL; protected URL _bundleURL;
/** A list of all the resources included in this bundle. */ /** A list of all the resources included in this bundle. */
protected HashSet<String> _rsrcList; protected HashSet<String> _rsrcList;
} }