Constructs the stream handler giving it all the provided information.
@return stream handler
438764
private SpeechletRequestHandler getRequestStreamHandler() {
        final Set<String> supportedApplicationIds = getSupportedApplicationIds();
        // at least one supported application-id need to be provided
        Validate.notEmpty(supportedApplicationIds, "Must provide supported application-id either with overriding the getter or using AlexaApplication-annotation in " + this.getClass().getSimpleName());

        return new SpeechletRequestHandler(
                Collections.singletonList(
                        new ApplicationIdSpeechletRequestVerifier(supportedApplicationIds)),
                Arrays.asList(
                        new ResponseSizeSpeechletResponseVerifier(),
                        new OutputSpeechSpeechletResponseVerifier(),
                        new CardSpeechletResponseVerifier()));
    }
1356156
private function getFileHandler()
    {
        if (is_null($this->fileHandler)) {
            $path = rtrim($this->path, '/');
            $this->fileHandler = new FileHandler($this->rootDir.$path);
        }
        
        return $this->fileHandler;
    }
779871
public function getStream()
    {
        if (!$this->_stream instanceof StreamInterface) {
            if ($this->_stream === null) {
                if ($this->getError() !== UPLOAD_ERR_OK) {
                    throw new \RuntimeException('Unable to create file stream due to upload error: ' . $this->getError());
                }
                $stream = [
                    '__class' => FileStream::class,
                    'filename' => $this->tempFilename,
                    'mode' => 'r',
                ];
            } elseif ($this->_stream instanceof \Closure) {
                $stream = \call_user_func($this->_stream, $this);
            } else {
                $stream = $this->_stream;
            }

            $this->_stream = Yii::ensureObject($stream, StreamInterface::class);
        }
        return $this->_stream;
    }
997374
function streamHandler(stream) {
    return stream
      .pipe(plumber())
      .pipe(sourcemaps.init({loadMaps: true}))
      .pipe(sourcemaps.write('.', {includeContent: true, sourceRoot: '.'}))
      .pipe(gulp.dest(dest));
  }
15012
public function getReadHandler()
    {
        if (null === $this->stream) {
            $this->stream = fopen($this->uri, 'r');
        }
        return $this->stream;
    }
484699
public function getStreamWriter()
    {
        if ($this->streamWriter !== null) {
            return $this->streamWriter;
        }

        return $this->streamWriter = new StreamWriter($this);
    }
1129900
@Override
    public ReadStream<Buffer> handler(Handler<Buffer> handler) {
        if (handler == null) {
            throw new IllegalArgumentException("handler");
        }
        this.dataHandler = handler;
        doRead();
        return this;
    }
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;
    }
366309
public function getStream(): StreamInterface
        {
            if ($this->moved) {
                throw new \RuntimeException(sprintf('Uploaded file %1s has already been moved', $this->clientFilename));
            }
            return $this->file;
        }
366661
public function openStream()
    {
        $url      = $this->endpoints[$this->method];
        $urlParts = parse_url($url);
        $isSecure = ($urlParts['scheme'] == 'https');
        $scheme   = $isSecure ? 'ssl://' : 'tcp://';
        $port     = $isSecure ? 443 : 80;

        $requestParams = [];

        if ($this->lang) {
            $requestParams['language'] = $this->lang;
        }

        if (($this->method === self::METHOD_FILTER || $this->method === self::METHOD_USER) && count($this->trackWords) > 0) {
            $requestParams['track'] = implode(',', $this->trackWords);
        }
        if (($this->method === self::METHOD_FILTER || $this->method === self::METHOD_SITE) && count($this->followIds) > 0) {
            $requestParams['follow'] = implode(',', $this->followIds);
        }

        if ($this->method === self::METHOD_FILTER && $this->location) {
            $requestParams['locations'] = implode(',', $this->location->getBoundingBox());
        }

        if ($this->count <> 0) {
            $requestParams['count'] = $this->count;
        }

        $this->stop();

        return $this->connectAsync($isSecure, $urlParts['host'], $port)
        ->then(function() use ($url, $requestParams) {
            $this->connectRetryCount = 0;
            return $this->readFromStream
              ($url, $requestParams, $this->oauth->getAuthorizationHeader('POST', $url, $requestParams))
            ->then(function($res) {
                if ($this->isStopping) {
                  return;
                }
                if ($this->readRetryCount == 0)
                  $this->emit("online", [0]);
                $this->readRetryCount++;
                $err = null;
                if ($res['type'] == 'http')
                    $err = $this->getExceptionForHttpStatus($res['code']);
                else if ($res['type'] == 'stalled')
                    $err = new \TwitterException("Stalled");
                else if ($res['type'] == 'disconnected')
                    $err = new \TwitterException("Disconnected");
                else if ($res['type'] == 'err')
                    $err = $res['err'];
                if ($this->readRetryCount >= self::MAX_RETRY_ATTEMPTS) {
                    throw $err;
                } else {
                    $this->emit("warning", [$err]);
                    if ($res['type'] == 'http') {
                        $is420 = (isset($res['code']) && $res['code'] == 420);
                        $time = $is420 ? self::RETRY_TIME_420 : self::RETRY_TIME;
                        $time = $time * pow(2, $this->readRetryCount - 1);
                        $max = ($is420 ? self::MAX_RETRY_TIME_420 : self::MAX_RETRY_TIME);
                        $time = min($time, $max);
                    } else {
                        $time = 0.5;
                    }
                    echo "Stream Retry #{$this->readRetryCount} in $time s - " . print_r($res, true) . "\n";
                    $this->loop->addTimer($time, function() {
                        $this->openStream();
                    });
                }
            })
            ->otherwise(function($err) {
                throw $err;
            });
        })
        ->otherwise(function($err) {
            $this->connectRetryCount = 0;
            $this->readRetryCount = 0;
            $this->emit("error", [$err]);
            $this->emit("online", [0]);
        });
    }
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;
    }
709399
private function getStream()
    {
        if ($this->stream && get_resource_type($this->stream) === 'Unknown') {
            fclose($this->stream);
            $this->stream = null;
        }
        if (!$this->stream) {
            $this->stream = @fopen($this->streamUrl, 'a');
            if (!$this->stream) {
                LoggerPolicy::processIOError("Error open $this->streamUrl");
                $this->stream = null;
            }
        }

        return $this->stream;
    }
1066068
protected void handleStream() {
        inboundStreamHandler.handle(new ISignalWriteStream() {
            boolean streamFinished = false;

            @Override
            public void write(IApimanBuffer buffer) {
                if (streamFinished) {
                    throw new IllegalStateException("Attempted write after #end() was called."); //$NON-NLS-1$
                }
                requestChain.write(buffer);
            }

            @Override
            public void end() {
                requestChain.end();
                streamFinished = true;
            }

            /**
             * @see io.apiman.gateway.engine.io.IAbortable#abort()
             */
            @Override
            public void abort(Throwable t) {
                // If this is called, it means that something went wrong on the inbound
                // side of things - so we need to make sure we abort and cleanup the
                // api connector resources.  We'll also call handle() on the result
                // handler so that the caller knows something went wrong.
                streamFinished = true;
                apiConnection.abort(t);
                resultHandler.handle(AsyncResultImpl.<IEngineResult>create(new RequestAbortedException(t)));
            }


            @Override
            public boolean isFinished() {
                return streamFinished;
            }

            @Override
            public void drainHandler(IAsyncHandler<Void> drainHandler) {
                apiConnection.drainHandler(drainHandler);
            }

            @Override
            public boolean isFull() {
                return apiConnection.isFull();
            }
        });
    }
294269
public function getStream()
    {
        if ($this->moved === true) {
            throw new \RuntimeException('File has already been moved to disk.');
        }

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

        return $this->stream = new Stream($this->stream);
    }
825464
public function getStreamReader()
    {
        if ($this->streamReader !== null) {
            return $this->streamReader;
        }

        return $this->streamReader = new StreamReader($this);
    }
614765
public static function make()
    {
        $stream = new Stream();
        $source = static::getSource();
        $stream->copy($source);

        if (! static::$source) {
            fclose($source);
        }

        return $stream;
    }
222305
public function handleRead()
    {
        try
        {
            if (!$this->reading)
            {
                return;
            }

            $length = $this->bufferSize;
            $ret = fread($this->resource, $length);

            if ($ret === false)
            {
                $this->emit('error', [ $this, new ReadException('Error occurred while reading from the stream resource.') ]);
                return;
            }

            if ($ret !== '')
            {
                $this->emit('data', [ $this, $ret ]);

                if (strlen($ret) < $length)
                {
                    $this->reading = false;
                    $this->emit('end', [ $this ]);
                }
            }
        }
        catch (Error $ex)
        {
            $this->emit('error', [ $this, $ex ]);
        }
        catch (Exception $ex)
        {
            $this->emit('error', [ $this, $ex ]);
        }
    }