for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace WebStream\IO\Writer;
use WebStream\IO\OutputStream;
/**
* OutputStreamWriter
* @author Ryuichi TANAKA.
* @since 2016/02/24
* @version 0.7
*/
class OutputStreamWriter
{
* @var OutputStream 出力ストリーム
protected $stream;
* constructor
* @param OutputStream $stream 出力ストリーム
public function __construct(OutputStream $stream)
$this->stream = $stream;
}
* destructor
public function __destruct()
$this->close();
* バッファリングしているすべての出力バイトを書き出し、出力ストリームを閉じる
* @throws WebStream\Exception\Extend\IOException
public function close()
$this->stream->close();
* 出力ストリームに書き出す
* @param mixed $buf 出力データ
* @param int $off データ開始位置
* @param int $len 書き出すバイト数
public function write($buf, int $off = null, int $len = null)
$this->stream->write($buf, $off, $len);
* 改行を書き出す
public function newLine()
$this->stream->write(PHP_EOL);
* バッファリングしているすべての出力バイトを出力ストリームを閉じずに強制的に書き出す
* writeを実行した時点では書き出されておらず、flushした時点ですべて書き出す
public function flush()
$this->stream->flush();