public function replace(string $data): string
    {
        if (!$this->valid()) {
            throw new OutOfBoundsException('The iterator is not valid!');
        }
        
        $temp = $this->buffer[$this->current];
        
        $this->buffer[$this->current] = $data;
        
        return $temp;
    }
public function replace(string $data): string
    {
        if (!$this->valid()) {
            throw new OutOfBoundsException('The iterator is not valid!');
        }
        
        $temp = $this->buffer[$this->current];
        
        $this->buffer[$this->current] = $data;
        
        return $temp;
    }
public function replace ( string $ data ) : string { if ( ! $ this -> valid ( ) ) { throw new OutOfBoundsException ( 'The iterator is not valid!' ) ; } $ temp = $ this -> buffer [ $ this -> current ] ; $ this -> buffer [ $ this -> current ] = $ data ; return $ temp ; }
Replaces the byte at the current iterator position with the given string.

@param string $data

@return string

@throws \Icicle\Stream\Exception\OutOfBoundsException If the iterator is invalid.
Replaces the byte at the current iterator position with the given string .