. */ /** * Dummy class for reading character streams. * @package phing.system.io */ class StringReader extends Reader { private $_string; private $mark = 0; private $currPos = 0; function __construct($string) { $this->_string = $string; } function skip($n) {} function read($len = null) { if ($len === null) { return $this->_string; } else { if ($this->currPos >= strlen($this->_string)) { return -1; } $out = substr($this->_string, $this->currPos, $len); $this->currPos += $len; return $out; } } function mark() { $this->mark = $this->currPos; } function reset() { $this->currPos = $this->mark; } function close() {} function open() {} function ready() {} function markSupported() { return true; } function getResource() { return '(string) "'.$this->_string . '"'; } } ?>