Gets resource from a String location.

@param location the metadata location
@return the resource from
@throws IOException the exception
339427
public static AbstractResource getResourceFrom(final String location) throws IOException {
        val metadataLocationResource = getRawResourceFrom(location);
        if (!metadataLocationResource.exists() || !metadataLocationResource.isReadable()) {
            throw new FileNotFoundException("Resource " + location + " does not exist or is unreadable");
        }
        return metadataLocationResource;
    }
401393
public static InputStream getRequiredResourceAsStream(Class<?> clzz, String location) {
        InputStream resourceStream = clzz.getResourceAsStream(location);

        if (resourceStream == null) {
            // Try with a leading "/"
            if (!location.startsWith("/")) {
                resourceStream = clzz.getResourceAsStream("/" + location);
            }
            if (resourceStream == null) {
                throw new RuntimeException("Resource file was not found at location " + location);
            }
        }

        return resourceStream;
    }
564893
public static URL getResource(String ref) {

		URL url = null;
		
		for (int i=0;i<locations.size();i++) {
			ResourceLocation location = (ResourceLocation) locations.get(i);
			url = location.getResource(ref);
			if (url != null) {
				break;
			}
		}
		
		if (url == null)
		{
			throw new RuntimeException("Resource not found: "+ref);
		}
			
		return url;
	}
1361824
public Map<String, URL> getResourcesMap(String uri) throws IOException {
        String basePath = path + uri;

        Map<String, URL> resources = new HashMap<>();
        if (!basePath.endsWith("/")) {
            basePath += "/";
        }
        Enumeration<URL> urls = getResources(basePath);

        while (urls.hasMoreElements()) {
            URL location = urls.nextElement();

            try {
                if (location.getProtocol().equals("jar")) {

                    readJarEntries(location, basePath, resources);

                } else if (location.getProtocol().equals("file")) {

                    readDirectoryEntries(location, resources);

                }
            } catch (Exception e) {
            }
        }

        return resources;
    }
475764
public static String getContent(String stringUrl, Map<String, String> parameters)
      throws IOException {
    return getContent(stringUrl, parameters, null);
  }
187258
public static ApiGatewayResponse build302Response(String location) {
        Map<String, String> headers = new HashMap<>();
        headers.put("Location", location);
        return ApiGatewayResponse.builder()
                .setStatusCode(302)
                .setHeaders(headers)
                .build();
    }
62852
public static Location retrieve(String location) throws StripeException {
    return retrieve(location, (Map<String, Object>) null, (RequestOptions) null);
  }
881156
@Nullable
  public static Location getParent(Location location) {
    URI source = location.toURI();

    // If it is root, return null
    if ("/".equals(source.getPath())) {
      return null;
    }

    URI resolvedParent = URI.create(source.toString() + "/..").normalize();
    return location.getLocationFactory().create(resolvedParent);
  }
1113744
public static byte[] resourceFileToByteArray(final String location, final String fileName) {
        if (location == null || fileName == null) return null;

        final InputStream in = ResourceUtilities.class.getResourceAsStream(location + fileName);
        if (in == null) return null;

        final ByteArrayOutputStream out = new ByteArrayOutputStream();

        try {
            // Create the byte array to hold the data
            final byte[] buffer = new byte[1024];

            // Read in the bytes
            int numRead = 0;
            while((numRead = in.read(buffer)) > 0) {
                out.write(buffer, 0, numRead);
            }
        } catch (final Exception ex) {
            LOG.error("An error occurred while reading the file contents", ex);
        } finally {
            try {
                in.close();
            } catch (final Exception ex) {
                LOG.error("Failed to close the InputStream", ex);
            }
        }
        return out.toByteArray();
    }
1018452
public static Dictionary read(Path location) throws IOException {
    final Path metadata = DictionaryMetadata.getExpectedMetadataLocation(location);

    try (InputStream fsaStream = Files.newInputStream(location);
         InputStream metadataStream = Files.newInputStream(metadata)) {
      return read(fsaStream, metadataStream);
    }
  }
513863
public Location getLocation(String str) {
        InetAddress addr;
        try {
            addr = InetAddress.getByName(str);
        } catch (UnknownHostException e) {
            return null;
        }

        return getLocation(addr);
    }
1095242
public static location[] get(nitro_service service) throws Exception{
		location obj = new location();
		location[] response = (location[])obj.get_resources(service);
		return response;
	}
264719
public ImageIcon retrieveIcon(URL location) throws IconProviderException
	{
		if (!getCache().containsKey(location))
		{
			getCache().put(location, new ImageIcon(location));
		}
		return getCache().get(location);
	}
741433
private void setLocation(String _location) {

        String res = null;
        File resFile = null;

        boolean relativePath = true;
        boolean defaultPath = false;

        // try as "absolute" resource (contains symbol, or absolute path)
        try {
            res = cfgSvc.resolveString(_location);
            resFile = new File(res);
            relativePath = !resFile.isAbsolute();
        } catch (IllegalStateException e) {
            // ignore
        }

        if (resFile == null || (!resFile.isFile() && relativePath)) {
            // look for resource in server config location
            try {
                res = cfgSvc.resolveString(LibertyConstants.DEFAULT_CONFIG_LOCATION + _location);
                resFile = new File(res);
            } catch (IllegalStateException e) {
                // ignore
            }

            if (resFile == null || !resFile.isFile()) {
                // fall back to creating for resource in shared output location
                try {
                    res = cfgSvc.resolveString(LibertyConstants.DEFAULT_OUTPUT_LOCATION + _location);
                    resFile = new File(res);
                    defaultPath = true;
                } catch (IllegalStateException e) {
                    // ignore
                }
            }
        }

        // Work against the symbol in the original location
        // The original location may be been
        if (isDefault && (defaultPath || locationInOutputDir(_location))) {
            this.initializeAtStartup = true;
        }

        // reset location w/ resolved value
        // isDefault tested because the default path's file may not exists (and that's OK)
        if ((res != null && resFile.isFile()) || isDefault) {
            this.location = res;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Found store under [" + location + "]");
            }
        } else {
            // If it wasn't found then it's likely going to trigger
            // the load.error later. Issue a warning to explain the file
            // could not be found.
            Tr.warning(tc, "ssl.keystore.not.found.warning", res, name);
        }
    }
547184
public Observable<UsagesListResultInner> listUsagesAsync(String location) {
        return listUsagesWithServiceResponseAsync(location).map(new Func1<ServiceResponse<UsagesListResultInner>, UsagesListResultInner>() {
            @Override
            public UsagesListResultInner call(ServiceResponse<UsagesListResultInner> response) {
                return response.body();
            }
        });
    }
1014557
public void load(ResourceLocation resourceLocation)
	{
		try
		{
			IResource res = Minecraft.getMinecraft().getResourceManager().getResource(resourceLocation);
			load(res.getInputStream());
		}
		catch (IOException e)
		{
			MalisisCore.log.error("[ObjFileImporter] An error happened while reading the file : {}", resourceLocation, e);
		}

	}
130819
public URL find(String uri) throws IOException {
        String fullUri = path + uri;

        URL resource = getResource(fullUri);
        if (resource == null) {
            throw new IOException("Could not find resource '" + fullUri + "'");
        }

        return resource;
    }