Reads and returns resources content denoted by the
given <tt>path</tt>.

@param path Path of the resources to read.
@return Resource content as {@link InputStream}.
179834
public static InputStream getResourceStream(final String path) {
		final ClassLoader loader = Resources.class.getClassLoader();
		return loader.getResourceAsStream(path);
	}
763793
public static String readFirstLine(String path) throws FileNotFoundException, IOException {
        try (FileInputStream fis = new FileInputStream(path)) {
            try (InputStreamReader isr = new InputStreamReader(fis)) {
                try (BufferedReader br = new BufferedReader(isr)) {
                    return br.readLine();
                }
            }
        }
    }
54573
public Optional<OPFItem> getResource(String path)
  {
    return (path == null || !resources.containsKey(path)) ? Optional.<OPFItem> absent()
        : Optional.of(resources.get(path).item);
  }
29986
public static Properties loadProperties(String path){
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        InputStream in = null;
        try {
            in = cl.getResourceAsStream(path);

            Properties properties = new Properties();
            properties.load(in);

            return properties;

        } catch(IOException ex){
            return null;

        } finally {
            IOUtil.closeQuietly(in);
        }
    }
1115338
protected InputStream openAsset(String path) throws IOException {
    String fullPath = normalizePath(pathPrefix + path);
    InputStream is = (expansionLoader == null) ?
      assetMgr.open(fullPath, AssetManager.ACCESS_STREAMING) :
      expansionLoader.openStream(fullPath);
    if (is == null)
      throw new FileNotFoundException("Missing resource: " + fullPath);
    return is;
  }
1026592
public static BufferedReader newBufferedReader(String path) throws IOException
    {
        return new BufferedReader(new InputStreamReader(IOUtil.newInputStream(path), "UTF-8"));
    }
662009
public static InputStream asInputStream(Path path) throws IOException {
		Validate.notNull(path, "path is null");
		return Files.newInputStream(path);
	}
552707
private String readFile(String path) {

        String result = (String)CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().getCachedObject(m_cms, path);
        if (result == null) {
            try {
                CmsFile file = m_cms.readFile(path);
                result = getContentAsString(file);
            } catch (CmsException e) {
                throw new RuntimeException(e);
            }
        }
        if (result != null) {
            CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().putCachedObject(m_cms, path, result);
        }
        return result;

    }
748444
public static BufferedReader getReader(Path path, Charset charset) throws IORuntimeException {
		return IoUtil.getReader(getInputStream(path), charset);
	}
874719
public static InputStream getResourceAsStream(String pPath) {
        for (ClassLoader loader : new ClassLoader[] {
                Thread.currentThread().getContextClassLoader(),
                ClassUtil.class.getClassLoader()
        } ) {
            if (loader != null) {
                InputStream is = loader.getResourceAsStream(pPath);
                if (is != null) {
                    return is;
                }
            }
        }
        return null;
    }
1107389
public static final Properties read(String classpath) throws IOException{
        final URL url = Resources.getResource(classpath);
        final ByteSource byteSource = Resources.asByteSource(url);
        final Properties properties = new Properties();
        InputStream inputStream = null;
        try {
            inputStream = byteSource.openBufferedStream();
            properties.load(inputStream);
        } catch (final IOException ioException) {
            ioException.printStackTrace();
        } finally {
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (final IOException ioException) {
                    throw ioException;
                }
            }
        }
        return properties;
    }
865563
public static BufferedReader getReader(String path, String charsetName) throws IORuntimeException {
		return getReader(file(path), charsetName);
	}
202696
public InputStream getResourceAsStream(String name)
  {
    Source path;

    path = getPath(name);

    if (path != null && path.canRead()) {
      try {
        return path.inputStream();
      } catch (Exception e) {
      }
    }

    return null;
  }
1300801
public @Nonnull Optional<InputStream> getResourceAsStream(@Nonnull String path) {
        ArgumentUtils.requireNonNull("path", path);
        Optional<ResourceLoader> resourceLoader = getSupportingLoader(path);
        if (resourceLoader.isPresent()) {
            return resourceLoader.get().getResourceAsStream(path);
        }
        return Optional.empty();
    }
1285163
public static String readTxt(String path)
    {
        if (path == null) return null;
        try
        {
            InputStream in = IOAdapter == null ? new FileInputStream(path) :
                    IOAdapter.open(path);
            byte[] fileContent = new byte[in.available()];
            int read = readBytesFromOtherInputStream(in, fileContent);
            in.close();
            // 处理 UTF-8 BOM
            if (read >= 3 && fileContent[0] == -17 && fileContent[1] == -69 && fileContent[2] == -65)
                return new String(fileContent, 3, fileContent.length - 3, Charset.forName("UTF-8"));
            return new String(fileContent, Charset.forName("UTF-8"));
        }
        catch (FileNotFoundException e)
        {
            logger.warning("找不到" + path + e);
            return null;
        }
        catch (IOException e)
        {
            logger.warning("读取" + path + "发生IO异常" + e);
            return null;
        }
    }
312548
public URL getResource(String path) throws MalformedURLException {
		Result<URL,MalformedURLException> result = getResourceCache.get(path, getResourceRefresher);
		MalformedURLException exception = result.getException();
		if(exception != null) throw exception;
		return result.getValue();
	}
1344246
public static byte[] readBytes(String path)
    {
        try
        {
            if (IOAdapter == null) return readBytesFromFileInputStream(new FileInputStream(path));

            InputStream is = IOAdapter.open(path);
            if (is instanceof FileInputStream)
                return readBytesFromFileInputStream((FileInputStream) is);
            else
                return readBytesFromOtherInputStream(is);
        }
        catch (Exception e)
        {
            logger.warning("读取" + path + "时发生异常" + e);
        }

        return null;
    }