sun.misc.CompoundEnumeration Java Examples
The following examples show how to use
sun.misc.CompoundEnumeration.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseDexClassLoader.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
@Override protected Enumeration<URL> findResources(String name) { Enumeration<URL> myResources = pathList.findResources(name); if (sharedLibraryLoaders == null) { return myResources; } Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[sharedLibraryLoaders.length + 1]; // This will add duplicate resources if a shared library is loaded twice, but that's ok // as we don't guarantee uniqueness. for (int i = 0; i < sharedLibraryLoaders.length; i++) { try { tmp[i] = sharedLibraryLoaders[i].getResources(name); } catch (IOException e) { // Ignore. } } tmp[sharedLibraryLoaders.length] = myResources; return new CompoundEnumeration<>(tmp); }
Example #2
Source File: AbstractClasspathClassLoader.java From sofa-ark with Apache License 2.0 | 6 votes |
/** * Find export resources * @param resourceName * @return */ @SuppressWarnings("unchecked") protected Enumeration<URL> getExportResources(String resourceName) throws IOException { if (shouldFindExportedResource(resourceName)) { List<ClassLoader> exportResourceClassLoadersInOrder = classloaderService .findExportResourceClassLoadersInOrder(resourceName); if (exportResourceClassLoadersInOrder != null) { List<Enumeration<URL>> enumerationList = new ArrayList<>(); for (ClassLoader exportResourceClassLoader : exportResourceClassLoadersInOrder) { enumerationList.add(((AbstractClasspathClassLoader) exportResourceClassLoader) .getLocalResources(resourceName)); } return new CompoundEnumeration<>( enumerationList.toArray((Enumeration<URL>[]) new Enumeration<?>[0])); } } return Collections.emptyEnumeration(); }
Example #3
Source File: AbstractClasspathClassLoader.java From sofa-ark with Apache License 2.0 | 6 votes |
@Override public Enumeration<URL> getResources(String name) throws IOException { Handler.setUseFastConnectionExceptions(true); try { Enumeration<URL> ret = preFindResources(name); if (ret != null && ret.hasMoreElements()) { return ret; } ret = getResourcesInternal(name); if (ret != null && ret.hasMoreElements()) { return ret; } ret = postFindResources(name); return ret != null ? ret : new CompoundEnumeration<URL>( (Enumeration<URL>[]) new Enumeration<?>[] {}); } finally { Handler.setUseFastConnectionExceptions(false); } }
Example #4
Source File: AbstractClassLoaderHook.java From sofa-ark with Apache License 2.0 | 5 votes |
@Override public Enumeration<URL> postFindResources(String name, ClassLoaderService classLoaderService, T t) throws IOException { if ("any".equals(name)) { return classLoaderService.getArkClassLoader().getResources("sample-plugin.jar"); } List<Enumeration<URL>> enumerationList = new ArrayList<>(); return new CompoundEnumeration<>(enumerationList.toArray(new Enumeration[] {})); }
Example #5
Source File: DelegateLastClassLoader.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") final Enumeration<URL>[] resources = (Enumeration<URL>[]) new Enumeration<?>[] { Object.class.getClassLoader().getResources(name), findResources(name), (getParent() == null) ? null : getParent().getResources(name) }; return new CompoundEnumeration<>(resources); }
Example #6
Source File: AbstractClassLoaderHook.java From sofa-ark with Apache License 2.0 | 5 votes |
@Override public Enumeration<URL> preFindResources(String name, ClassLoaderService classLoaderService, T t) throws IOException { if ("R2".equals(name)) { return classLoaderService.getArkClassLoader().getResources("sample-biz.jar"); } List<Enumeration<URL>> enumerationList = new ArrayList<>(); return new CompoundEnumeration<>(enumerationList.toArray(new Enumeration[] {})); }
Example #7
Source File: AbstractClasspathClassLoader.java From sofa-ark with Apache License 2.0 | 5 votes |
/** * Real logic to get resources * @param name * @return * @throws IOException */ protected Enumeration<URL> getResourcesInternal(String name) throws IOException { List<Enumeration<URL>> enumerationList = new ArrayList<>(); // 1. find jdk resources enumerationList.add(getJdkResources(name)); // 2. find exported resources enumerationList.add(getExportResources(name)); // 3. find local resources enumerationList.add(getLocalResources(name)); return new CompoundEnumeration<>( enumerationList.toArray((Enumeration<URL>[]) new Enumeration<?>[0])); }
Example #8
Source File: WorkerClassLoader.java From jstorm with Apache License 2.0 | 4 votes |
public Enumeration<URL> getResources(String name) throws IOException { Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; tmp[0] = super.getResources(name); tmp[1] = defaultClassLoader.getResources(name); return new CompoundEnumeration<>(tmp); }
Example #9
Source File: ClassLoader.java From jdk8u-jdk with GNU General Public License v2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #10
Source File: ClassLoader.java From jdk-1.7-annotated with Apache License 2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { Enumeration[] tmp = new Enumeration[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #11
Source File: ClassLoader.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #12
Source File: ClassLoader.java From j2objc with Apache License 2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #13
Source File: ClassLoader.java From openjdk-jdk8u with GNU General Public License v2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #14
Source File: ClassLoader.java From jdk8u_jdk with GNU General Public License v2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #15
Source File: ClassLoader.java From openjdk-8 with GNU General Public License v2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #16
Source File: ClassLoader.java From openjdk-8-source with GNU General Public License v2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #17
Source File: ClassLoader.java From hottub with GNU General Public License v2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #18
Source File: ClassLoader.java From Java8CN with Apache License 2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #19
Source File: ClassLoader.java From jdk8u-jdk with GNU General Public License v2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #20
Source File: ClassLoader.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #21
Source File: ClassLoader.java From jdk1.8-source-analysis with Apache License 2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #22
Source File: ClassLoader.java From JDKSourceCode1.8 with MIT License | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #23
Source File: ClassLoader.java From jdk8u60 with GNU General Public License v2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #24
Source File: ClassLoader.java From TencentKona-8 with GNU General Public License v2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #25
Source File: ClassLoader.java From dragonwell8_jdk with GNU General Public License v2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }
Example #26
Source File: ClassLoader.java From AndroidComponentPlugin with Apache License 2.0 | 3 votes |
/** * Finds all the resources with the given name. A resource is some data * (images, audio, text, etc) that can be accessed by class code in a way * that is independent of the location of the code. * * <p>The name of a resource is a <tt>/</tt>-separated path name that * identifies the resource. * * <p> The search order is described in the documentation for {@link * #getResource(String)}. </p> * * @apiNote When overriding this method it is recommended that an * implementation ensures that any delegation is consistent with the {@link * #getResource(java.lang.String) getResource(String)} method. This should * ensure that the first element returned by the Enumeration's * {@code nextElement} method is the same resource that the * {@code getResource(String)} method would return. * * @param name * The resource name * * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for * the resource. If no resources could be found, the enumeration * will be empty. Resources that the class loader doesn't have * access to will not be in the enumeration. * * @throws IOException * If I/O errors occur * * @see #findResources(String) * * @since 1.2 */ public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { tmp[0] = getBootstrapResources(name); } tmp[1] = findResources(name); return new CompoundEnumeration<>(tmp); }