Get resource of open output stream. May be STDOUT or a file pointer
to the file specified by an option with 'STDOUT'. The file will be
truncated to 0 bytes on opening.

@return resource
352776
public function openOutput()
    {
        if (null === $this->_stdout) {
            return STDOUT;
        } else {
            $this->_stdout = fopen($this->_stdout, 'wb');

            return $this->_stdout;
        }
    }
618463
public function getContents()
    {
        if (!is_resource($this->stream)) {
            throw new \RuntimeException('Cannot read from empty resource stream');
        }

        $this->rewind();

        $contents = stream_get_contents($this->stream);

        if ($contents === false) {
            throw new \RuntimeException('Unable to read stream contents');
        }

        return $contents;
    }
1146553
public function getContents() : string
	{
		if (! \is_resource($this->resource))
		{
			throw new Exception\UnreadableStreamException('Stream is not resourceable');
		}

		if (! $this->isReadable())
		{
			throw new Exception\UnreadableStreamException('Stream is not readable');
		}

		$result = \stream_get_contents($this->resource);

		if (false === $result)
		{
			throw new Exception\UnreadableStreamException('Unable to read remainder of the stream');
		}

		return $result;
	}
756222
public function getStream()
    {
        if ($this->stream instanceof \Closure) {
            $this->stream = $this->stream->__invoke();
        }
        if (is_resource($this->stream)) {
            $meta = stream_get_meta_data($this->stream);
            if ($meta['seekable']) {
                rewind($this->stream);
            }
        }
        return $this->stream;
    }
927211
public function getBuffer()
    {
        $currentPos = $this->getPosition();
        $this->setPosition(0, SEEK_SET);
        $buffer = stream_get_contents($this->stream);
        $this->setPosition($currentPos, SEEK_SET);
        return $buffer;
    }
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);
	}
455716
public function open()
    {
        //Create a memory buffer
        if($this->getType() == 'memory')
        {
            $this->_resource = '';
            if($path = $this->getPath())
            {
                try {
                    $this->_resource = @file_get_contents($path);
                } catch (Exception $e) {
                    $this->_resource = false;
                }

                if ($this->_resource === false) {
                    throw new \RuntimeException(sprintf('Cannot get content from file : "%s"', $path));
                }
            }

            $this->_position     = 0;
            $this->_synchronised = true;

            //Truncate the file to zero length
            if(in_array($this->getMode(), array('w', 'w+'))) {
                $this->truncate(0);
            }

            //Place the file pointer at the end of the file
            if(in_array($this->getMode(), array('a', 'a+'))) {
                $this->_position = mb_strlen($this->_resource, '8bit');
            }

            return true;
        }

        return parent::open();
    }
908943
@Override
    public SmbPipeOutputStream getOutput () throws CIFSException {
        if ( !this.open ) {
            throw new SmbException("Already closed");
        }

        if ( this.output != null ) {
            return this.output;
        }

        try ( SmbTreeHandleImpl th = ensureTreeConnected() ) {
            this.output = new SmbPipeOutputStream(this, th);
        }
        return this.output;
    }
1285501
public function getInputStream()
    {
        if (0 === func_num_args() || func_get_arg(0)) {
            @trigger_error(sprintf('The %s() method is deprecated since version 3.2 and will be removed in 4.0. Use %s::getStream() instead.', __METHOD__, StreamableInputInterface::class), E_USER_DEPRECATED);
        }

        return $this->inputStream;
    }
608782
function getStream()
    {
        if ($err = $this->getError() !== UPLOAD_ERR_OK)
            // TODO Handle Upload With Exception Error
            throw new \RuntimeException(sprintf(
                'Cannot retrieve stream due to upload error. error: (%s).'
                , getUploadErrorMessageFromCode($err)
            ));

        if ($this->isFileMoved)
            throw new \RuntimeException('Cannot retrieve stream after it has already been moved');

        if ($this->stream)
            return $this->stream;

        $givenFileResource = $this->_c_givenResource;
        if (!$givenFileResource instanceof StreamInterface)
            $givenFileResource = new Stream($givenFileResource, 'r');
        
        return $this->stream = $givenFileResource;
    }
1078539
public function createInputStream(): InputStream {
		$this->ensureValid();
		try {
			return IoUtils::createSafeFileInputStream($this->fsPath);
		} catch (CouldNotAchieveFlockException $e) {
			return new FileResourceStream($this->fsPath, 'r');
		}
	}
992785
public function getBitStream()
    {

        $bstream = $this->mergeBitStream();

        if($bstream == null) {
            return null;
        }

        $ret = $this->appendPaddingBit($bstream);
        if($ret < 0) {
            return null;
        }

        return $bstream;
    }
137369
public OutputStream openStream() throws IllegalStateException {
        if (mClass != null) {
            throw new IllegalStateException("New class has already been defined");
        }
        ByteArrayOutputStream data = mData;
        if (data != null) {
            throw new IllegalStateException("Stream already opened");
        }
        mData = data = new ByteArrayOutputStream();
        return data;
    }
689513
public InputStream getInputStream()
    throws IOException
  {
    if (_indirectSource != null)
      return _indirectSource.getInputStream();
    else if (_out != null)
      return _out.openInputStream();
    else
      throw new IllegalStateException(L.l("{0}: no input stream is available",
                                          this));
  }
942212
public function getStream()
	{
		$this->validateActive();

		if ($this->stream instanceof StreamInterface) {
			return $this->stream;
		}

		return Factory::streamFromFile($this->file, 'r');
	}
93697
public function stream()
    {
        $stream = fopen($this->file, 'r');

        $stream = $stream === false ? null : $stream;

        return new Stream($stream);
    }
344199
public function getFile(){
        if(!$this->isPropertyAvailable('File')){
            $this->setProperty("File", new File($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "File")),false);
        }
        return $this->getProperty("File");
    }