[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 /* 3 * $Id: StringReader.php 3076 2006-12-18 08:52:12Z fabien $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 /** 23 * Dummy class for reading character streams. 24 * @package phing.system.io 25 */ 26 class StringReader extends Reader { 27 28 private $_string; 29 private $mark = 0; 30 private $currPos = 0; 31 32 function __construct($string) { 33 $this->_string = $string; 34 } 35 36 function skip($n) {} 37 38 function read($len = null) { 39 if ($len === null) { 40 return $this->_string; 41 } else { 42 if ($this->currPos >= strlen($this->_string)) { 43 return -1; 44 } 45 $out = substr($this->_string, $this->currPos, $len); 46 $this->currPos += $len; 47 return $out; 48 } 49 } 50 51 function mark() { 52 $this->mark = $this->currPos; 53 } 54 55 function reset() { 56 $this->currPos = $this->mark; 57 } 58 59 function close() {} 60 61 function open() {} 62 63 function ready() {} 64 65 function markSupported() { 66 return true; 67 } 68 69 function getResource() { 70 return '(string) "'.$this->_string . '"'; 71 } 72 } 73 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |