Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there heredoc alternative in Java (heredoc as PHP)? [duplicate]

Tags:

For JAVA development I need writing to a files with strings like "\r\t\n <>", because from Java I want writing a PHP file. If you can't understand look at this example:

BufferedWriter buffW = new BufferedWriter(fileW);
            buffW.write("<?php\n\n\tclass MyClass {\n\tpublic function test()\n}\n}\n?>");

This is mess a code, I want to write a clean such as PHP can do, but can't find on Java alternative way as example:

 <?php
$mystring = <<<EOT
    This is some PHP text.
    It is completely free
    I can use "double quotes"
    and 'single quotes',
    plus $variables too, which will
    be properly converted to their values,
    you can even type EOT, as long as it
    is not alone on a line, like this:
EOT;
?>