Returns persistent stream resource, which can be used to read file.
@return resource file stream resource.
199475
public function getResource()
    {
        if ($this->_resource === null) {
            $this->_resource = $this->toResource();
        }
        return $this->_resource;
    }
216485
public function stream()
	{
		$fp = fopen("php://memory", 'r+');
		fwrite($fp, $this->output());
		rewind($fp);
		return $fp;
	}
1323972
public FileInputStream getFileInputStream(final File file) throws FileNotFoundException {
        if (System.getSecurityManager() == null)
            return new FileInputStream(file);
        try {
            return AccessController.doPrivileged(new PrivilegedExceptionAction<FileInputStream>() {
                @Override
                public FileInputStream run() throws FileNotFoundException {
                    return new FileInputStream(file);
                }
            }, controlContext);
        } catch (PrivilegedActionException e) {
            if (e.getException() instanceof FileNotFoundException)
                throw (FileNotFoundException) e.getException();
            throw (RuntimeException) e.getException();
        }
    }
437943
public InputStream getInputStream()
    throws IOException
  {
    if (_is == null)
      _is = new FileInputStream(_file.getFD());

    return _is;
  }
215782
@Override
  public InputStream getResourceAsStream(String name) {

    InputStream result = null;

    if (bestCandidate != null) {
      result = bestCandidate.getResourceAsStream(name);
      if (result == null) {
        bestCandidate = null;
      }
    }

    ClassLoadHelper loadHelper = null;

    Iterator<ClassLoadHelper> iter = loadHelpers.iterator();
    while (iter.hasNext()) {
      loadHelper = iter.next();

      result = loadHelper.getResourceAsStream(name);
      if (result != null) {
        break;
      }
    }

    bestCandidate = loadHelper;
    return result;
  }
909054
public static InputStream getResourceAsStream(String resource) throws IOException {
    InputStream in = null;
    ClassLoader loader = ResourcesUtils.class.getClassLoader();
    if (loader != null) {
      in = loader.getResourceAsStream(resource);
    }
    if (in == null) {
      in = ClassLoader.getSystemResourceAsStream(resource);
    }
    if (in == null) {
      throw new IOException("Could not find resource " + resource);
    }
    return in;
  }
858984
@Override
	public OutputStream getResourceAsOutputStream(String resourceName) throws IOException {

		// Create directories if needed
		String generatedFilePath = resourceName.substring(workingDir.length());
		if (!FileNameUtils.isExtension(generatedFilePath, JawrConstant.CSS_TYPE)
				&& binaryGeneratorRegistry.isGeneratedBinaryResource(generatedFilePath)) {
			// for generated image put it in the generated Image directory
			generatedFilePath = workingDir + JawrConstant.SPRITE_GENERATED_IMG_DIR
					+ generatedFilePath.replace(':', '/');
		} else if (cssGeneratorRegistry.isPathGenerated(generatedFilePath)) { // Rename
																				// resource
																				// for
																				// For
																				// generated
																				// CSS
			generatedFilePath = workingDir + JawrConstant.SPRITE_GENERATED_CSS_DIR
					+ generatedFilePath.replace(':', '/');
		} else {
			generatedFilePath = resourceName;
		}

		final File parentFile = new File(generatedFilePath).getParentFile();
		if (!parentFile.exists()) {
			if (!parentFile.mkdirs()) {
				throw new IOException("Unable to create the directory : " + parentFile.getPath());
			}
		}

		File file = new File(generatedFilePath);
		try {
			file = file.getCanonicalFile();
		} catch (final IOException e) {
			file = file.getAbsoluteFile();
		}

		return new FileOutputStream(file);
	}
1147640
public static InputStream getResourceAsStream(final String resourcePath) {
        File resource = getFileForResource(resourcePath);

        if (!resource.exists() || resource.isDirectory()) {
            logger.error("Cannot read resource, does not exist"
                    + " (or is a directory).");
            return new NullInputStream(0);
        }

        try {
            return new FileInputStream(resource);
        } catch (IOException ioe) {
            logger.error(ioe.getMessage());
            return new NullInputStream(0);
        }
    }
179834
public static InputStream getResourceStream(final String path) {
		final ClassLoader loader = Resources.class.getClassLoader();
		return loader.getResourceAsStream(path);
	}
838721
public InputStream openStream() throws IOException {
        final SecurityManager sm = System.getSecurityManager();
        if (sm != null) {
            sm.checkPermission(new VirtualFilePermission(getPathName(), "read"));
        }
        if (isDirectory()) {
            return new VirtualJarInputStream(this);
        }
        final VFS.Mount mount = VFS.getMount(this);
        if (sm != null) {
            return doIoPrivileged(() -> mount.getFileSystem().openInputStream(mount.getMountPoint(), this));
        }
        return mount.getFileSystem().openInputStream(mount.getMountPoint(), this);
    }
754000
private static InputStream getStreamFromClasspath(String fileName)
    {
        String path = fileName;
        InputStream dtdStream = PersistenceXMLLoader.class.getClassLoader().getResourceAsStream(path);
        return dtdStream;
    }
1357504
public function toStream()
    {
        if (!\is_resource($this->process)) {
            $this->process = \proc_open('/usr/bin/env tar c .', [['pipe', 'r'], ['pipe', 'w'], ['pipe', 'w']], $pipes, $this->directory);
            $this->stream = $pipes[1];
        }

        return $this->stream;
    }
1204902
public IntStream stream()
    {
        IntStream.Builder builder = IntStream.builder();
        forEach(builder);
        return builder.build();
    }
788775
@Nullable
    public static InputStream getResourceAsStream(@NotNull String resource) {
        final ClassLoader classLoader = FileUtils.class.getClassLoader();
        final InputStream inputStream = classLoader != null
                ? classLoader.getResourceAsStream(resource)
                : ClassLoader.getSystemResourceAsStream(resource);

        if (inputStream == null) {
            try {
                return new FileInputStream(resource);
            } catch (final FileNotFoundException e) {
                LOGGER.error("Unable to create an Input Stream for " + resource, e);
            }
        }
        return inputStream;
    }
571323
protected function readStream()
    {
        if(!is_resource($this->stream)) {
            return '';
        }

        if(isset($headers['content-length'])) {
            $this->body = stream_get_contents($this->stream, $headers['content-length']);
        } else {
            $this->body = stream_get_contents($this->stream);
        }
        fclose($this->stream);
        $this->stream = null;
    }
304233
private static InputStream getResourceAsStream(String path) throws IOException {
    if (StringUtils.isEmpty(path)) {
      return null;
    }

    // first try to load as file
    File file = new File(path);
    if (file.exists() && file.isFile()) {
      return new FileInputStream(file);
    }

    // if not a file fallback to classloader resource
    return CertificateLoader.class.getResourceAsStream(path);
  }
272496
public InputStream getStream() {
        if (stream != null) {
            return stream;
        }
        try {
            return new ByteArrayInputStream(content.getBytes("utf-8"));
        } catch (final UnsupportedEncodingException e) {
            throw new ApiException("UTF-8 encoding not supported", e);
        }
    }