Taken from war plugin.

@param resource
@return array of file names that would be copied from specified resource
482386
private String[] getFilesToCopy(Resource resource) {
    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setBasedir(resource.getDirectory());
    if (resource.getIncludes() != null && !resource.getIncludes().isEmpty()) {
      scanner.setIncludes(resource.getIncludes().toArray(new String[0]));
    }
    else {
      scanner.setIncludes(DEFAULT_INCLUDES);
    }
    if (resource.getExcludes() != null && !resource.getExcludes().isEmpty()) {
      scanner.setExcludes(resource.getExcludes().toArray(new String[0]));
    }

    scanner.addDefaultExcludes();

    scanner.scan();

    return scanner.getIncludedFiles();
  }
665125
public static String getResourceURL(String resource) {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        return cl.getResource(resource).toString();
    }
869000
public static String getClassName(Resource resource) {
        try {
            return getClassName(resource.getFile().getAbsolutePath());
        } catch (IOException e) {
            return null;
        }
    }
141371
private List<Resource> parseWarResources(Xpp3Dom warResourcesNode) {
    List<Resource> resources = new ArrayList<Resource>();
    Xpp3Dom[] resourceNodes = warResourcesNode.getChildren("resource");
    for (Xpp3Dom resourceNode : resourceNodes) {
      if (resourceNode == null || resourceNode.getChild("directory") == null) {
        continue;
      }
      resources.add(parseResourceNode(resourceNode));
    }

    return resources;
  }
938913
protected boolean isSarlResource(Object resource) {
		if (resource instanceof IFile) {
			final IFile file = (IFile) resource;
			return getFileExtensions().contains(file.getFileExtension());
		}
		return false;
	}
193782
public function load($resource, $type = null): array
    {
        try {
            $path = $this->locator->locate($resource);
            $file = $this->filesystem->openFile($path);
            $configValues = $this->yamlParser->parse($file->getContents());

            return $configValues;
        } catch (FileLocatorFileNotFoundException $error) {
            return [];
        }
    }
504708
public static Set<String> getResourceNames(File dir) {

		Set<String> resourceNames = new HashSet<String>();

		// If the path is not valid throw an exception
		String[] resArray = dir.list();

		if (resArray != null) {
			// Make the returned dirs end with '/', to match a servletcontext
			// behavior.
			for (int i = 0; i < resArray.length; i++) {
				if (new File(dir, resArray[i]).isDirectory())
					resArray[i] += '/';
			}
			resourceNames.addAll(Arrays.asList(resArray));
		}
		return resourceNames;
	}
55905
private function getResourceData($resource)
    {
        $data = false;
        if(!is_null($resource) && $resource->exists()) {
            $resourceTypes = array_keys($resource->getTypes());
            $data = [
                'uri'        => $resource->getUri(),
                'classUri'   => $resourceTypes[0],
                'label'      => $resource->getLabel(),
                'type'       => 'instance'
            ];
        }
        return $data;
    }
891172
protected List<String> findAvailableLocales(String resource) {
		List<String> availableLocales = cachedAvailableLocalePerResource.get(resource);
		if (availableLocales == null) {
			availableLocales = LocaleUtils.getAvailableLocaleSuffixesForBundle(resource);
			cachedAvailableLocalePerResource.put(resource, availableLocales);
		}

		return availableLocales;
	}
910696
public static List<String> readConfigIntoLines(final String resource) throws IOException {
		BufferedReader br = null;
		try {
			br = ResourceLoader.getConfigBufferedReader(resource);
			return doReadIntoLines(br);
		} finally {
			IOUtils.closeQuietly(br);
		}
	}
743288
public List<CmsVariationBean> getVariations(String resource) {

        List<String> ret = (List<String>)(m_filePaths.get(resource));
        List<CmsVariationBean> res = new ArrayList<CmsVariationBean>();
        if (ret == null) {
            return new ArrayList<CmsVariationBean>();
        }
        for (String r : ret) {
            res.add(new CmsVariationBean(r));
        }
        return res;
    }
929591
def resource_name(self, resource):
        
        if not(resource in self.contents['files']):
            raise ValueError("No such resource %r in refpkg" % (resource,))
        return self.contents['files'][resource]
207445
@Override
    public URL[] findResources()
    {
        URL[] result = null;

        if (classesToScan != null && !classesToScan.isEmpty())
        {
            result = findResourcesByContextLoader();
        }
        // else
        // {
        // result = findResourcesByClasspath();
        // }
        return result;
    }
306575
protected String toFilename(final Resource resource) throws UnsupportedOperationException {
        if (resource instanceof FileResource) {
            return ((FileResource) resource).getFile().getPath();
        }
        if (resource instanceof HadoopResource) {
            return ((HadoopResource) resource).getTemplatedPath();
        }
        if (resource instanceof HdfsResource) {
            return resource.getQualifiedPath();
        }
        if (resource instanceof UrlResource) {
            return resource.getQualifiedPath();
        }
        throw new UnsupportedOperationException("Unsupported resource type: " + resource);
    }
294207
public static String readFromResource(String resource) throws IOException {

        InputStream in = getResourceAsStream(resource);
        if (in == null) {
            return null;
        }
        try {
            return read(in);
        } finally {
            closeQuietly(in);
        }
    }
1281516
public String[] getResourceNames() {
        if (null != resourcesList) {
            return resourcesList.toArray(new String[resourcesList.size()]);
        }
        if (null != basedirListing) {
            return basedirListing.toArray(new String[basedirListing.size()]);
        }
        String[] list = listZipPath(zipFile, resourcesBasedir);
        if (null != list) {
            basedirListing = Arrays.asList(list);
            return list;
        }
        return new String[0];
    }
1014637
@Override
	public Set<String> getResourceNames(String path) {

		Set<String> resources = null;

		URL resourceURL = null;

		try {
			resourceURL = ClassLoaderResourceUtils.getResourceURL(getCompletePath(path), this);
			if (resourceURL.toString().startsWith(JAR_URL_PREFIX)) {
				resources = getResourceNamesFromJar(path, resourceURL);
			} else if (resourceURL.toString().startsWith(FILE_URL_PREFIX)) {

				String dirPath = resourceURL.getFile();
				File dir = new File(dirPath);
				resources = FileUtils.getResourceNames(dir);
			}
		} catch (ResourceNotFoundException e) {

			if (LOGGER.isDebugEnabled()) {
				LOGGER.debug("Unable to find resources name for path '" + path + "'", e);
			}
			resources = Collections.emptySet();
		}

		return resources;
	}