Exemplo n.º 1
0
 /**
  * Get the next word in queue as a stream.
  * 
  * Get the next word in queue as a stream, after automatically decoding its
  * length.
  * 
  * @return resource The word, as a stream.
  * @see close()
  */
 public function getNextWordAsStream()
 {
     $filters = new T\FilterCollection();
     if (null !== ($remoteCharset = $this->getCharset(self::CHARSET_REMOTE)) && null !== ($localCharset = $this->getCharset(self::CHARSET_LOCAL))) {
         $filters->append('convert.iconv.' . $remoteCharset . '.' . $localCharset . '//IGNORE//TRANSLIT');
     }
     if ($this->trans->isPersistent()) {
         $old = $this->trans->lock(T\Stream::DIRECTION_RECEIVE);
         $stream = $this->trans->receiveStream(self::decodeLength($this->trans), $filters, 'stream word');
         $this->trans->lock($old, true);
     } else {
         $stream = $this->trans->receiveStream(self::decodeLength($this->trans), $filters, 'stream word');
     }
     return $stream;
 }