Czy istnieje alternatywa heredoc w Javie (heredoc jako PHP)? [duplikować]

To pytanie ma już tutaj odpowiedź:

Wielowierszowy ciąg Java 39 odpowiedzi

Dla rozwoju JAVA potrzebuję napisać do plików z łańcuchami takimi jak „r <>”, ponieważ z Java chcę napisać plik PHP. Jeśli nie możesz zrozumieć tego przykładu:

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

To jest bałagan w kodzie, chcę napisać czysty, taki jak PHP, ale nie mogę znaleźć na Java alternatywnego sposobu jako przykładu:

 <?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;
?> 

questionAnswers(1)

yourAnswerToTheQuestion