protected function loadBuffer()
	{
		$this->remainder = 0;
		
		if($this->ended)
		{
			return;
		}
		
		while(!$this->stream->eof() && strlen($this->buffer) < self::BUFFER_SIZE)
		{
			$this->buffer .= $this->stream->read(self::BUFFER_SIZE);
		}
		
		$m = NULL;
		
		if(preg_match("'^\r?\n?([a-fA-F0-9]+).*\r\n'", $this->buffer, $m))
		{
			$this->remainder = hexdec($m[1]);
			$this->buffer = (string)substr($this->buffer, strlen($m[0]));
			
			if($this->remainder === 0)
			{
				$this->buffer = '';
				$this->ended = true;
			}
			else
			{
				while(!$this->stream->eof() && strlen($this->buffer) < $this->remainder)
				{
					$this->buffer .= $this->stream->read($this->remainder);
				}
				
				if(strlen($this->buffer) < $this->remainder)
				{
					$this->buffer = '';
					$this->ended = true;
				}
			}
		}
		else
		{
			$this->buffer = '';
			$this->ended = true;
		}
	}
protected function loadBuffer()
	{
		$this->remainder = 0;
		
		if($this->ended)
		{
			return;
		}
		
		while(!$this->stream->eof() && strlen($this->buffer) < self::BUFFER_SIZE)
		{
			$this->buffer .= $this->stream->read(self::BUFFER_SIZE);
		}
		
		$m = NULL;
		
		if(preg_match("'^\r?\n?([a-fA-F0-9]+).*\r\n'", $this->buffer, $m))
		{
			$this->remainder = hexdec($m[1]);
			$this->buffer = (string)substr($this->buffer, strlen($m[0]));
			
			if($this->remainder === 0)
			{
				$this->buffer = '';
				$this->ended = true;
			}
			else
			{
				while(!$this->stream->eof() && strlen($this->buffer) < $this->remainder)
				{
					$this->buffer .= $this->stream->read($this->remainder);
				}
				
				if(strlen($this->buffer) < $this->remainder)
				{
					$this->buffer = '';
					$this->ended = true;
				}
			}
		}
		else
		{
			$this->buffer = '';
			$this->ended = true;
		}
	}
protected function loadBuffer ( ) { $ this -> remainder = 0 ; if ( $ this -> ended ) { return ; } while ( ! $ this -> stream -> eof ( ) && strlen ( $ this -> buffer ) < self :: BUFFER_SIZE ) { $ this -> buffer .= $ this -> stream -> read ( self :: BUFFER_SIZE ) ; } $ m = NULL ; if ( preg_match ( "'^\r?\n?([a-fA-F0-9]+).*\r\n'" , $ this -> buffer , $ m ) ) { $ this -> remainder = hexdec ( $ m [ 1 ] ) ; $ this -> buffer = ( string ) substr ( $ this -> buffer , strlen ( $ m [ 0 ] ) ) ; if ( $ this -> remainder === 0 ) { $ this -> buffer = '' ; $ this -> ended = true ; } else { while ( ! $ this -> stream -> eof ( ) && strlen ( $ this -> buffer ) < $ this -> remainder ) { $ this -> buffer .= $ this -> stream -> read ( $ this -> remainder ) ; } if ( strlen ( $ this -> buffer ) < $ this -> remainder ) { $ this -> buffer = '' ; $ this -> ended = true ; } } } else { $ this -> buffer = '' ; $ this -> ended = true ; } }
Load data of the next chunk into memory.
Load data of the next chunk into memory .