diff options
Diffstat (limited to 'netx/net/sourceforge/jnlp/JNLPFile.java')
-rw-r--r-- | netx/net/sourceforge/jnlp/JNLPFile.java | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/netx/net/sourceforge/jnlp/JNLPFile.java b/netx/net/sourceforge/jnlp/JNLPFile.java index bf1c96b..c296a9a 100644 --- a/netx/net/sourceforge/jnlp/JNLPFile.java +++ b/netx/net/sourceforge/jnlp/JNLPFile.java @@ -248,7 +248,7 @@ public class JNLPFile { try { ResourceTracker tracker = new ResourceTracker(false); // no prefetch - tracker.addResource(location, version, policy); + tracker.addResource(location, version, null, policy); return tracker.getInputStream(location); } catch (Exception ex) { @@ -362,7 +362,7 @@ public class JNLPFile { } /** - * Returns the information section of the JNLP file for the + * Returns the resources section of the JNLP file for the * specified locale, os, and arch. */ public ResourcesDesc getResources(final Locale locale, final String os, final String arch) { @@ -392,6 +392,31 @@ public class JNLPFile { } /** + * Returns the resources section of the JNLP file as viewed + * through the default locale and the os.name and os.arch + * properties. + */ + public ResourcesDesc[] getResourceDescs() { + return getResourceDescs(defaultLocale, defaultOS, defaultArch); + } + + /** + * Returns the resources section of the JNLP file for the + * specified locale, os, and arch. + */ + public ResourcesDesc[] getResourceDescs(final Locale locale, final String os, final String arch) { + List<ResourcesDesc> matchingResources = new ArrayList<ResourcesDesc>(); + for (ResourcesDesc rescDesc: resources) { + if (localMatches(locale, rescDesc.getLocales()) + && stringMatches(os, rescDesc.getOS()) + && stringMatches(arch, rescDesc.getArch())) { + matchingResources.add(rescDesc); + } + } + return matchingResources.toArray(new ResourcesDesc[0]); + } + + /** * Returns an object of one of the following types: AppletDesc, * ApplicationDesc and InstallerDesc */ |