public function stream_write($data) { return (int) $this->stream->write($data); }
/** * Copy the contents of a stream into another stream until the given number * of bytes have been read. * * @param puzzle_stream_StreamInterface $source Stream to read from * @param puzzle_stream_StreamInterface $dest Stream to write to * @param int $maxLen Maximum number of bytes to read. Pass -1 * to read the entire stream. */ public static function copyToStream(puzzle_stream_StreamInterface $source, puzzle_stream_StreamInterface $dest, $maxLen = -1) { if ($maxLen === -1) { while (!$source->eof()) { if (!$dest->write($source->read(1048576))) { break; } } return; } $bytes = 0; while (!$source->eof()) { $buf = $source->read($maxLen - $bytes); if (!($len = strlen($buf))) { break; } $bytes += $len; $dest->write($buf); if ($bytes == $maxLen) { break; } } }
/** * {@inheritdoc} */ public function write($string) { return $this->_delegate->write($string); }