32 Class Swift_CharacterStream_NgCharacterStream
120 $this->_charset = $charset;
121 $this->_charReader = null;
132 $this->_charReaderFactory = $factory;
141 $this->_datas = null;
143 $this->_charCount = 0;
144 $this->_currentPos = 0;
145 $this->_datasSize = 0;
158 while(
false!==($read = $os->
read($blocks)))
170 $this->
write($string);
181 if ($this->_currentPos>=$this->_charCount)
187 ? $this->_charCount - $this->_currentPos
189 switch ($this->_mapType)
193 $ret = substr($this->_datas,
194 $this->_currentPos * $this->_map,
196 $this->_currentPos += $length;
200 $end = $this->_currentPos + $length;
201 $end = $end > $this->_charCount
207 if (isset ($this->_map[$this->_currentPos]))
219 $end = $this->_currentPos + $length;
220 $end = $end > $this->_charCount
225 if ($this->_currentPos>0)
227 $start = $this->_map[
'p'][$this->_currentPos-1];
232 if (isset($this->_map[
'i'][$this->_currentPos])) {
253 $read=$this->
read($length);
256 $ret = array_map(
'ord', str_split($read, 1));
269 if ($this->_charCount<$charOffset){
272 $this->_currentPos = $charOffset;
282 if (!isset($this->_charReader))
284 $this->_charReader = $this->_charReaderFactory->getReaderFor(
286 $this->_map = array();
287 $this->_mapType = $this->_charReader->getMapType();
290 $this->_datas .= $chars;
291 $this->_charCount += $this->_charReader->getCharPositions(substr($this->_datas, $this->_datasSize), $this->_datasSize, $this->_map, $ignored);
292 if ($ignored!==
false) {
293 $this->_datasSize=strlen($this->_datas)-strlen($ignored);
297 $this->_datasSize=strlen($this->_datas);