protected function createOutputContents(
        array $header,
        $delimiter = ',',
        $enclosure = '"',
        $toConvert = true
    )
    {
        $fp = fopen("php://temp", 'r+b');

        // header
        if ($header) {
            fputcsv($fp, $header, $delimiter, $enclosure);
        }

        foreach ($this->rows as $row) {
            fputcsv($fp, $row, $delimiter, $enclosure);
        }

        rewind($fp);

        $buffer = stream_get_contents($fp);

        if ($toConvert === false) {
            fclose($fp);
            return $buffer;
        }

        $ret = $this->convert($buffer);

        fclose($fp);

        return $ret;
    }